Re: How to convert a UTF-8 byte offset into an NSString character offset?

2014-05-07 Thread Uli Kusterer
On 06 May 2014, at 20:12, Quincey Morris  
wrote:
> FWIW, my opinion is that if your library clients are specifying UTF-8 
> sequences at the API, and expect byte offsets into those sequences to be 
> meaningful, you might well be forced to maintain the original UTF-8 sequence 
> in the library’s internal data model — or, perhaps, an array of the original 
> code points — and do all of your internal processing in terms of code points. 
> Conversion to NSString would happen only in the journey from data model to UI 
> text field.

 This is pretty much what I do in one of my projects. I hand-wrote code for 
converting between offsets, mostly based on tutorials from the net, knowing my 
offsets are always at the start/end of code points, and knowing that my 
conversion code always generates the same sequence, just encoding as UTF8/UTF16 
as needed to display in the UI or convert selection offsets back to UTF8 
offsets. The code hasn't shipped (or been tested much beyond myself using the 
app for a while), but if you're interested, contact me off-list and I'll send 
you a copy.

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


___

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

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

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

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

Re: Help with Help

2014-05-07 Thread Uli Kusterer
On 29 Apr 2014, at 19:52, Gordon Apple  wrote:
> We would like to get a recommendation on the best way to generate a help
> system for a fairly complex application. We started by using a simple web
> view and created about 120 screens in BBEdit, mostly drill-down outlines.
> Unfortunately, this has been proven to be difficult to maintain. We¹ve
> looked into web generators like RapidWeaver, Freeway, and even Dreamweaver,
> but all of these have been described as ³roach motels² where you enter but
> can never leave.
> 
> We would like to have both local and web-based or web-updated content and
> have contextual help. This all brings us to Apple¹s ³Help Book², which seems
> to have been around forever and presents its own learning curve. So the
> question is: Is this the way to go?  It it still current? What are the
> experiences in using it?

 At its core, a help book is just HTML, with a few extra tags thrown in. So I'd 
recommend that.

 That said, if you're looking for a tool to generate such help, that's your 
answer as well. Pick anything that spits out HTML and lets you add the required 
extra tags. This includes all web programming languages, i.e. I worked on a 
project where we ran the PHP command line tool over a bunch of PHP files and 
generated plain HTML files suitable for use with Apple Help from that. These 
days you'd probably go with Ruby or so.

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


___

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

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

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

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

Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Jakob Egger
I have a NSTableView that spans the full width of the window, so it touches the 
window borders on both sides. The table view has many columns (it scrolls 
horizontally).

Changing column witdth columns by dragging the separator line works perfectly, 
except for the last column. The problem is that the separator line coincides 
with the window border, so when I try to drag it the window is resized, rather 
than the column.

Did anybody else stumble upon this problem?

Is there any way to tell the window to not resize when clicking near the table 
header? I couldn't find anything in the docs on NSWindow.

Or can you think of another workaround, aside from leaving an ugly 
brushed-metal-like border around the table view? 

Best wishes,
Jakob
___

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

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

2014-05-07 Thread Jakob Egger
I'd strongly recommend against using Apple's Help Book application. There are a 
few problems with Apple Help:


Problems with Help Books


First of all, they are poorly documented. It is extremely difficult to 
structure them in the right way. You can't use HTML5, you have to use some 
special XHTML doctype. It took me weeks to find the right tags / anchors and 
all the implicit requirements to get it working.

Once you get them working, they might fail mysteriously. Sometimes Help Viewer 
won't find your Help Book. Sometimes it will take 30 seconds or longer until 
the Help Book is displayed, without any sensible feedback to the user. 
Sometimes old versions of your Help Book will be displayed.

Searching Help Books is slow. Again, no feedback, so your users will think 
there are no results, when in reality Help Viewer is still indexing your help 
book.

Additionally, the erratic behaviour seemed to change with every major version 
of OS X.

Finally, when I contacted Apple Developer Technical Support, they told me that 
they don't offer support for Help Books.


Alternatives
=

The solution I went with was to use a simple web view that displays normal HTML 
pages. A plain window with three toolbar items: back / forward / index. 
Additionally, I provide the documentation for the latest version on my website.

The HTML in the app and on the website is slightly different, I use PHP to 
generate the HTML.

A more modern approach would probably be to use a static site generator like 
Jekyll, which would allow you to use templates, write in Markdown, etc.

Best wishes,
Jakob


Am 29.04.2014 um 19:52 schrieb Gordon Apple :

> We would like to get a recommendation on the best way to generate a help
> system for a fairly complex application. We started by using a simple web
> view and created about 120 screens in BBEdit, mostly drill-down outlines.
> Unfortunately, this has been proven to be difficult to maintain. We¹ve
> looked into web generators like RapidWeaver, Freeway, and even Dreamweaver,
> but all of these have been described as ³roach motels² where you enter but
> can never leave.
> 
> We would like to have both local and web-based or web-updated content and
> have contextual help. This all brings us to Apple¹s ³Help Book², which seems
> to have been around forever and presents its own learning curve. So the
> question is: Is this the way to go?  It it still current? What are the
> experiences in using it?
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/jakob%40eggerapps.at
> 
> This email sent to ja...@eggerapps.at


___

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

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

2014-05-07 Thread Bill Cheeseman

On May 7, 2014, at 9:44 AM, Jakob Egger  wrote:

> Problems with Help Books
> 
> 
> First of all, they are poorly documented.

I disagree with most of Mr. Egger's comments about Help Book problems, but he 
is certainly right that they are still poorly documented. The documentation 
confuses the pre- and post-Snow Leopard forms of Help Books and is virtually 
impossible to follow, despite years of complaints to Apple.

As far as I know, the only comprehensive explanation of the "new" post-Snow 
Leopard version of Help Books is Chapter 11 of my book, Cocoa Recipes for Mac 
OS X, Second Edition (Peachpit Press 2010).

-- 

Bill Cheeseman - b...@cheeseman.name

___

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

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

NSData problems and viewing buffer data in hex

2014-05-07 Thread William Squires
Quickie question: Does [NSData getBytes:range:] return .length bytes 
into the buffer specified, even if some of the bytes may be '\0' (terminating 
null), so long as range is valid? I'm trying to read in a specified record from 
a random-access file (record length is 1000 bytes = kRecSize), and I have a 
self.fileContents that's an  @property (nonatomic, strong) NSData 
*fileContents, which I set up as follows:

"FSSBorr.m"
---
#import "FSSBorr.h"

char buffer[kRecSize + 1]; // <-file scope

#pragma mark "Private Suff"

@interface FSSBorr ()

@property (nonatomic, assign) BORR_REC theRec;
@property (nonatomic, copy) NSString *fileName; // These two are set up in 
my initWithFile:
@property (nonatomic, strong) NSData *fileContents; // ditto

@end

@implementation FSSBorr

...

-(void)loadRec:(NSUInteger)index
{
NSUInteger byteOffset = index * kRecSize;
NSRange recordRange = NSMakeRange(byteOffset, kRecSize);
char *c = &buffer[0];
char *p = (char *)(&_theRec);

@try
  {
  [self.fileContents getBytes:buffer range:recordRange]; // Problem is here - 
not reading in all 1000 bytes.
  memccpy(p, c, kRecSize, sizeof(char));
  }
@catch (NSException *ex)
  {
  NSLog(@"%ul beyond end of file.\n", (unsigned int)index);
  NSLog(@"NSException thrown: %@\n", [ex description]);
  }
}

@end

The file in question is several hundred kB long, and "index" = 1 for this debug 
session. Is there some way to view the buffer (contents) as a hex dump? I know 
what the bytes should be (I used "hexdump -Cv .dat > .txt 
to get the hex dump of .dat, which is what self.fileContents is 
loaded with in my initWithFile: method of this class.


___

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

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

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

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

Re: NSData problems and viewing buffer data in hex

2014-05-07 Thread Jens Alfke

On May 7, 2014, at 9:21 AM, William Squires  wrote:

> Quickie question: Does [NSData getBytes:range:] return .length bytes 
> into the buffer specified, even if some of the bytes may be '\0' (terminating 
> null), so long as range is valid?

If it’s a valid sub-range of the data it’ll copy range.length bytes into the 
buffer, otherwise it’ll raise an exception.
Whether or not the bytes are zeros has nothing to do with it … NSData doesn’t 
care what the data is, it’s just a blob.

—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

NSNumberFormatter 10.0+ style exception with zero

2014-05-07 Thread Howard Moon
Hi,

is the 10.0+ style of NSNumberFormatter no longer supported?  I 
recently moved from developing in Xcode3 under OS X 10.7 to Xcode 4 under OS X 
10.8, and from having a Base SDK of 10.6 to 10.7, and from a Deployment Target 
of 10.5 to 10.6, and am now having problems with my xib-base NSTextFields 
connected to an NSNumberFormatter.  The formatter uses the 10.0+ style, 
allowing me to set the "Zero" field, which I am setting to the string N/A.  
This worked fine, even when running in 10.8 or 10.9, but crashes now that I've 
compiled under these new conditions.

Here is the call stack when the exception is thrown:

2014-05-07 08:32:15.225 Cubase 7.5[947:707] -[__NSCFString string]: 
unrecognized selector sent to instance 0x1050188d0
2014-05-07 08:32:15.226 Cubase 7.5[947:707] NSInvalidArgumentException - 
-[__NSCFString string]: unrecognized selector sent to instance 0x1050188d0
0   CoreFoundation  0x7fff92b32aee 
__exceptionPreprocess + 174
1   libobjc.A.dylib 0x7fff8b8b13f0 objc_exception_throw 
+ 43
2   CoreFoundation  0x7fff92bc940a -[NSObject(NSObject) 
doesNotRecognizeSelector:] + 186
3   CoreFoundation  0x7fff92b2102e ___forwarding___ + 
414
4   CoreFoundation  0x7fff92b20e18 
_CF_forwarding_prep_0 + 232
5   Foundation  0x7fff93bc592b 
-[NSNumberFormatter(NSNumberFormatterCompatibility2) 
__oldnf_stringForObjectValue:] + 192
6   AppKit  0x7fff8bd2ba93 -[NSCell 
_stringForEditing] + 83
7   AppKit  0x7fff8bd35a32 -[NSCell 
_skipsSynchronizationForEditingTextView:] + 34
8   AppKit  0x7fff8bc5e43f -[NSCell 
setObjectValue:] + 296
9   AppKit  0x7fff8bc5e2fd -[NSTextFieldCell 
setObjectValue:] + 43
10  AppKit  0x7fff8be51cbd -[NSCell 
_setIntegerValue:] + 196
11  AppKit  0x7fff8be47f49 -[NSControl 
setIntValue:] + 138
...

I am simply calling setIntValue with a value of 0, which in previous builds 
would set the text field's text to "N/A".  But now this exception is thrown, 
and I don't know why or what to do about it.  If the 10.0 style of 
NSNumberFormatter is no longer supported, why is it still available in Xcode 4, 
and why does it compile and run, up to the point I set its value to 0?

Thanks,
-Howard

___

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

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

2014-05-07 Thread Gordon Apple
Wow! That¹s quite an indictment of one of Apple, Inc¹s supposed developer
tools. You¹d think that with $190B cash, they could fix this. One of the
problems I ran into is that I couldn¹t find the indexing tool without going
back to old versions.  When I tried to use it, it choked, spewing a litany
of error messages.  So much for that (and using contextual help anchors).

I did take a stab at using the $39 (30-day free trial) HelpSupreme app.
Aside from a few bugs, anomalies, and irritations, it worked, but I didn¹t
care for the format. (That might be fixable in their CSS files.)
Unfortunately, it has no provision for external links, movie files, or
anchors.

I then tried the $150 (limited free trial) SimpleHelpEditor. It¹s a lot more
capable, but complex, and you end up having to write all the HTML yourself
anyway, so why bother?

One thing I found out is that if your root file is not index.html, you¹d
better make sure your help file identifier does not have any spaces in it.

I¹m considering just going back to my original (successful) approach and
doing it all in BBEdit, for lack of finding any superior approach.


On 5/7/14 8:44 AM, "Jakob Egger"  wrote:

> I'd strongly recommend against using Apple's Help Book application. There are
> a few problems with Apple Help:
> 
> 
> Problems with Help Books
> 
> 
> First of all, they are poorly documented. It is extremely difficult to
> structure them in the right way. You can't use HTML5, you have to use some
> special XHTML doctype. It took me weeks to find the right tags / anchors and
> all the implicit requirements to get it working.
> 
> Once you get them working, they might fail mysteriously. Sometimes Help Viewer
> won't find your Help Book. Sometimes it will take 30 seconds or longer until
> the Help Book is displayed, without any sensible feedback to the user.
> Sometimes old versions of your Help Book will be displayed.
> 
> Searching Help Books is slow. Again, no feedback, so your users will think
> there are no results, when in reality Help Viewer is still indexing your help
> book.
> 
> Additionally, the erratic behaviour seemed to change with every major version
> of OS X.
> 
> Finally, when I contacted Apple Developer Technical Support, they told me that
> they don't offer support for Help Books.
> 
> 
> Alternatives
> =
> 
> The solution I went with was to use a simple web view that displays normal
> HTML pages. A plain window with three toolbar items: back / forward / index.
> Additionally, I provide the documentation for the latest version on my
> website.
> 
> The HTML in the app and on the website is slightly different, I use PHP to
> generate the HTML.
> 
> A more modern approach would probably be to use a static site generator like
> Jekyll, which would allow you to use templates, write in Markdown, etc.
> 
> Best wishes,
> Jakob

___

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

Please do not post 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: NSData problems and viewing buffer data in hex

2014-05-07 Thread Uli Kusterer
On 07 May 2014, at 18:21, William Squires  wrote:
> Quickie question: Does [NSData getBytes:range:] return .length bytes 
> into the buffer specified, even if some of the bytes may be '\0' (terminating 
> null),

The concept of terminating zeroes only exists in strings. NSData will preserve 
the bytes as they were given and copy them out. If they're zeroes, then they're 
zeroes.

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


___

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

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

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

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

Re: Help with Help

2014-05-07 Thread Kirk
Apple help is unacceptably slow. 

I just opened Safari's help, and it timed out, giving the "no information for 
that topic" message.  Subsequent invocations are faster, but it is still a 
painful performance.

And this was on an Core i7 MBP with 16gB of RAM.  

I further note that Apple's own iWork apps use online help pages that open in 
Safari. 

Perhaps that is a hint. 

Kirk Kerekes 
(iPhone)

> On May 7, 2014, at 12:08 PM, cocoa-dev-requ...@lists.apple.com wrote:
> 
> Send Cocoa-dev mailing list submissions to
>cocoa-dev@lists.apple.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>https://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
>cocoa-dev-requ...@lists.apple.com
> 
> You can reach the person managing the list at
>cocoa-dev-ow...@lists.apple.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
> 
> 
> Today's Topics:
> 
>   1. NSWorkspace issue (Varun Chandramohan)
>   2. Re: NSWorkspace issue (Ken Thomases)
>   3. Re: How to convert a UTF-8 byte offset into an NSString
>  characteroffset? (Uli Kusterer)
>   4. Re: Help with Help (Uli Kusterer)
>   5. Resizing last column of NSTableView when it touches window
>  border (Jakob Egger)
>   6. Re: Help with Help (Jakob Egger)
>   7. Re: Help with Help (Bill Cheeseman)
>   8. NSData problems and viewing buffer data in hex (William Squires)
>   9. Re: NSData problems and viewing buffer data in hex (Jens Alfke)
>  10. NSNumberFormatter 10.0+ style exception with zero (Howard Moon)
>  11. Re: Help with Help (Gordon Apple)
> 
> 
> --
> 
> Message: 1
> Date: Wed, 07 May 2014 05:02:54 +
> From: Varun Chandramohan 
> To: Cocoa dev 
> Subject: NSWorkspace issue
> Message-ID: 
> Content-Type: text/plain; charset="us-ascii"
> 
> Hi All,
> 
> I wanted to open a Finder window from my app with a file pre-selected. The 
> user could perform any Finder operations needed. I looked around the internet 
> and it turns out the best way to do this is using NSWorkspace.
> 
> 
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
> 
> {
> 
>// Insert code here to initialize your application
> 
>NSURL *fileURL = [NSURL URLWithString:@"/Users/usr/Desktop/libd.dylib"];
> 
>NSArray *fileURLs = [NSArray arrayWithObjects:fileURL, nil];
> 
>[[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];
> 
> }
> 
> However, I am not sure what is going on. The Finder window never pops up. I 
> do see the top bar change to Finder bar but then the window is never present. 
> The file I am trying to highlight is present. Is there anyway to know error 
> code? The method is void.
> 
> Regards,
> Varun
> 
> 
> --
> 
> Message: 2
> Date: Wed, 07 May 2014 00:58:21 -0500
> From: Ken Thomases 
> To: Varun Chandramohan 
> Cc: Cocoa dev 
> Subject: Re: NSWorkspace issue
> Message-ID: 
> Content-Type: text/plain; charset=us-ascii
> 
>> On May 7, 2014, at 12:02 AM, Varun Chandramohan wrote:
>> 
>>   NSURL *fileURL = [NSURL URLWithString:@"/Users/usr/Desktop/libd.dylib"];
> 
> This is not correct.  +[NSURL URLWithString:] expects a valid URL string.  
> What you're providing is a file path string, which is not a URL string.  A 
> URL string might be "http://www.apple.com"; or 
> "file:///Users/usr/Desktop/libd.dylib".  However, never just prepend 
> "file://" to a file path to try to make it into a URL string.  That doesn't 
> correctly handle a path which contains characters which are not valid in URLs.
> 
> The correct thing to do is use +[NSURL fileURLWithPath:] or a similar method.
> 
> Regards,
> Ken
> 
> 
> 
> 
> --
> 
> Message: 3
> Date: Wed, 07 May 2014 14:13:52 +0200
> From: Uli Kusterer 
> To: Quincey Morris 
> Cc: Cocoa Dev List 
> Subject: Re: How to convert a UTF-8 byte offset into an NSString
>characteroffset?
> Message-ID: 
> Content-Type: text/plain; charset=windows-1252
> 
>> On 06 May 2014, at 20:12, Quincey Morris 
>>  wrote:
>> FWIW, my opinion is that if your library clients are specifying UTF-8 
>> sequences at the API, and expect byte offsets into those sequences to be 
>> meaningful, you might well be forced to maintain the original UTF-8 sequence 
>> in the library’s internal data model — or, perhaps, an array of the original 
>> code points — and do all of your internal processing in terms of code 
>> points. Conversion to NSString would happen only in the journey from data 
>> model to UI text field.
> 
> This is pretty much what I do in one of my projects. I hand-wrote code for 
> converting between offsets, mostly based on tutorials from the net, knowing 
> my offsets are always at the start/end of code points, and knowing that my 
> conversion code always generates the same sequence, just encoding as 
> UTF8/UTF1

Re: Help with Help

2014-05-07 Thread Todd Heberlein

On May 7, 2014, at 6:53 AM, Bill Cheeseman  wrote:

> As far as I know, the only comprehensive explanation of the "new" post-Snow 
> Leopard version of Help Books is Chapter 11 of my book, Cocoa Recipes for Mac 
> OS X, Second Edition (Peachpit Press 2010).

I used Cheeseman’s book, and it did help a lot.

Still, getting all the variables set in both the app’s and the HelpBook’s 
.plist files set up right can be a pain. One minor mistake and nothing seems to 
work.

Also, the Help document is cached somewhere, so when I make a change, 
recompile, and test the new Help, the old cached version is typically loaded 
(not the new one). I’ve forgotten how to get rid of that cached HelpBook 
gracefully. I often just logout and log back in to reset it.

Another challenge is making sure there are no syntax errors in your HTML. With 
just the tiniest error, hiutil will stop indexing it, and by default, it will 
stop quietly. Make sure you use the “-v” option to flag anything.

Here are the steps I follow to index my system (at least for English). Watch 
the output of the first two hiutil commands carefully because (at least for me) 
this is where I find many of my mistakes.

$ hiutil -Cavf /tmp/MyHelp.helpindex English.lproj
$ hiutil -Fvf /tmp/MyHelp.helpindex
$ cd English.lproj
$ cp /tmp/MyHelp.helpindex .

Todd



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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

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

Serializing NSDictionary for network transfer

2014-05-07 Thread Carl Hoefs
OS X 10.9
Newb questions re: serializing an NSDictionary for network transfer to another 
process. I've read over the Apple documentation, but it seems to detail the 
methods involved but not how to use serialization, and some methods seem to 
require writing archives or plist files to disk. So, I must be approaching this 
all wrong...

(1) I see that NSDictionary has an encoding method:

- (void)encodeWithCoder:(NSCoder *)coder;

but this returns (void), which is puzzling to me. I would expect it to return 
(void *) to a malloced region containing the serialization. Where does the 
object serialization reside, and how do I access it?

(2) On the receiving end, I see that NSDictionary has the method:

- (id)initWithCoder:(NSCoder *)coder;

How do I apply this method to the byte stream that I have received to 
instantiate a populated NSDictionary object?

-Carl


___

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

Please do not post 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: Serializing NSDictionary for network transfer

2014-05-07 Thread Joseph Dixon
Consider NSJSONSerialization.   

-jwd// Joseph W. Dixon

OS X 10.9
Newb questions re: serializing an NSDictionary for network transfer to another 
process. I've read over the Apple documentation, but it seems to detail the 
methods involved but not how to use serialization, and some methods seem to 
require writing archives or plist files to disk. So, I must be approaching this 
all wrong...

(1) I see that NSDictionary has an encoding method:

- (void)encodeWithCoder:(NSCoder *)coder;

but this returns (void), which is puzzling to me. I would expect it to return 
(void *) to a malloced region containing the serialization. Where does the 
object serialization reside, and how do I access it?

(2) On the receiving end, I see that NSDictionary has the method:

- (id)initWithCoder:(NSCoder *)coder;

How do I apply this method to the byte stream that I have received to 
instantiate a populated NSDictionary object?

-Carl


___

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

Please do not post 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/jwdixon%40gmail.com

This email sent to jwdi...@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: Serializing NSDictionary for network transfer

2014-05-07 Thread Carl Hoefs
On May 7, 2014, at 11:21 AM, Joseph Dixon  wrote:

> Consider NSJSONSerialization.

Hmm, I hadn't come across NSJSONSerialization. Looks straightforward to use.
Thanks!
-Carl

___

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

Please do not post 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: Serializing NSDictionary for network transfer

2014-05-07 Thread Quincey Morris
On May 7, 2014, at 11:17 , Carl Hoefs  wrote:

> (1) I see that NSDictionary has an encoding method:
> 
> - (void)encodeWithCoder:(NSCoder *)coder;
> 
> but this returns (void), which is puzzling to me. I would expect it to return 
> (void *) to a malloced region containing the serialization. Where does the 
> object serialization reside, and how do I access it?

NSKeyedArchiver and NSKeyedUnarchiver are the classes that perform the encoding 
and decoding. They are responsible for invoking ‘encodeWithCoder:’ and 
‘initWithCoder:’ for the objects that make up an archive — you don’t do that 
yourself.

Both NSKeyedArchiver and NSKeyedUnarchiver have convenience class methods for 
archiving and unarchiving an object hierarchy to/from NSData. (You can also 
create instances of NSKeyedArchiver and NSKeyedUnarchiver if you need a finer 
level of control.)

Class NSPropertyListSerialization provides a similar service, but for a more 
restricted kind of object graph, useful when you want a textual representation 
of the data, for example.

You really should read some of the documentation:


https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Archiving/Archiving.html

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html

Just reading the introductory sections should orient you in this Cocoa sub 
universe.

___

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

Please do not post 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: Serializing NSDictionary for network transfer

2014-05-07 Thread Wim Lewis

On 7 May 2014, at 11:17 AM, Carl Hoefs wrote:
> Newb questions re: serializing an NSDictionary for network transfer to 
> another process. I've read over the Apple documentation, but it seems to 
> detail the methods involved but not how to use serialization, and some 
> methods seem to require writing archives or plist files to disk. So, I must 
> be approaching this all wrong...
> 
> (1) I see that NSDictionary has an encoding method:
> 
> - (void)encodeWithCoder:(NSCoder *)coder;
> 
> but this returns (void), which is puzzling to me. I would expect it to return 
> (void *) to a malloced region containing the serialization. Where does the 
> object serialization reside, and how do I access it?

It is accumulated in the coder. NSCoder is an abstract class; the concrete 
class you're using (eg NSKeyedArchiver) will have a way to get the serialized 
data in or out.

NSKeyedArchiver also has a convenience method, +archivedDataWithRootObject:, 
for the common case of writing a single object (and recursively any objects it 
references/contains) and getting the data out.

Depending on what is *in* your NSDictionary, though, a less opaque 
serialization format might be better, such as one of the property-list formats 
(see NSPropertyListSerialization) or even JSON. These formats can only hold a 
small, non-extensible set of types, and can't encode recursive structures or 
preserve the sharedness of parts of the object graph, but have the significant 
advantage that they are easier to inspect and are easier to keep decoupled from 
implementation details of your app.



___

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

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

2014-05-07 Thread Marco S Hyman
> The HTML in the app and on the website is slightly different, I use PHP to 
> generate the HTML.
> 
> A more modern approach would probably be to use a static site generator like 
> Jekyll, which would allow you to use templates, write in Markdown, etc.

You can use Markdown with PHP: https://github.com/michelf/php-markdown
and possibly others to generate your static pages, too.

Marc
___

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

Please do not post 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: Serializing NSDictionary for network transfer

2014-05-07 Thread Carl Hoefs

On May 7, 2014, at 11:38 AM, Wim Lewis  wrote:

> Depending on what is *in* your NSDictionary, though, a less opaque 
> serialization format might be better, such as one of the property-list 
> formats (see NSPropertyListSerialization) or even JSON. These formats can 
> only hold a small, non-extensible set of types, and can't encode recursive 
> structures or preserve the sharedness of parts of the object graph, but have 
> the significant advantage that they are easier to inspect and are easier to 
> keep decoupled from implementation details of your app.

I realize I have a ways to go before I grok Cocoa, as I still approach things 
from the minimalist Linux perspective. It's a simple NSDictionary with a few 
strings and numbers in it, so maybe (for the moment) the JSON approach might 
get me going, then I can revisit the issue with a more general Cocoa solution.

Thanks!
-Carl


___

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

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

2014-05-07 Thread Alex Zavatone

On May 7, 2014, at 2:06 PM, Todd Heberlein wrote:

> 
> On May 7, 2014, at 6:53 AM, Bill Cheeseman  wrote:
> 
>> As far as I know, the only comprehensive explanation of the "new" post-Snow 
>> Leopard version of Help Books is Chapter 11 of my book, Cocoa Recipes for 
>> Mac OS X, Second Edition (Peachpit Press 2010).
> 
> I used Cheeseman’s book, and it did help a lot.
> 
> Still, getting all the variables set in both the app’s and the HelpBook’s 
> .plist files set up right can be a pain. One minor mistake and nothing seems 
> to work.
> 
> Also, the Help document is cached somewhere, so when I make a change, 
> recompile, and test the new Help, the old cached version is typically loaded 
> (not the new one). I’ve forgotten how to get rid of that cached HelpBook 
> gracefully. I often just logout and log back in to reset it.
> 

Shot in the dark, but If the help doc reference is a URL, is it possible to 
force an fresh load by tacking a ? on to the end of the URL when it is loaded 
and supplying no parameters?

GL,

- Alex
___

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

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

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

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

Re: Serializing NSDictionary for network transfer

2014-05-07 Thread Alex Zavatone
If your dictionary has only text values, this should be no problem with the 
NSJSONSerialization, but if you're sending images, you'll need to convert the 
images to 16 bit encoded NSData objects.

I guess the bigger question is, "what are the data types within your 
dictionary"?

If it's just text, then you should have good luck with NSJSONSerialization.

Another question is, "where are you sending that data to?"  What type of 
service will receive it?

Cheers, 
- Alex

On May 7, 2014, at 2:38 PM, Wim Lewis wrote:

> 
> On 7 May 2014, at 11:17 AM, Carl Hoefs wrote:
>> Newb questions re: serializing an NSDictionary for network transfer to 
>> another process. I've read over the Apple documentation, but it seems to 
>> detail the methods involved but not how to use serialization, and some 
>> methods seem to require writing archives or plist files to disk. So, I must 
>> be approaching this all wrong...
>> 
>> (1) I see that NSDictionary has an encoding method:
>> 
>> - (void)encodeWithCoder:(NSCoder *)coder;
>> 
>> but this returns (void), which is puzzling to me. I would expect it to 
>> return (void *) to a malloced region containing the serialization. Where 
>> does the object serialization reside, and how do I access it?
> 
> It is accumulated in the coder. NSCoder is an abstract class; the concrete 
> class you're using (eg NSKeyedArchiver) will have a way to get the serialized 
> data in or out.
> 
> NSKeyedArchiver also has a convenience method, +archivedDataWithRootObject:, 
> for the common case of writing a single object (and recursively any objects 
> it references/contains) and getting the data out.
> 
> Depending on what is *in* your NSDictionary, though, a less opaque 
> serialization format might be better, such as one of the property-list 
> formats (see NSPropertyListSerialization) or even JSON. These formats can 
> only hold a small, non-extensible set of types, and can't encode recursive 
> structures or preserve the sharedness of parts of the object graph, but have 
> the significant advantage that they are easier to inspect and are easier to 
> keep decoupled from implementation details of your app.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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

Re: Serializing NSDictionary for network transfer

2014-05-07 Thread SevenBits
On Wednesday, May 7, 2014, Carl Hoefs 
wrote:

>
> On May 7, 2014, at 11:38 AM, Wim Lewis >
> wrote:
>
> > Depending on what is *in* your NSDictionary, though, a less opaque
> serialization format might be better, such as one of the property-list
> formats (see NSPropertyListSerialization) or even JSON. These formats can
> only hold a small, non-extensible set of types, and can't encode recursive
> structures or preserve the sharedness of parts of the object graph, but
> have the significant advantage that they are easier to inspect and are
> easier to keep decoupled from implementation details of your app.
>
> I realize I have a ways to go before I grok Cocoa, as I still approach
> things from the minimalist Linux perspective. It's a simple NSDictionary
> with a few strings and numbers in it, so maybe (for the moment) the JSON
> approach might get me going, then I can revisit the issue with a more
> general Cocoa solution.


That will work only as long the types in the NSDictionary are textual types
representable in JSON, as previously stated. If even one element is not,
the archiving will fail. I prefer to archive to binary data because usually
the user never has to read the serialized data in its raw form, plus it
avoids the disadvantages of non-extensibility and no recursion.


>
> Thanks!
> -Carl
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com )
>
> Please do not post 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/sevenbitstech%40gmail.com
>
> This email sent to sevenbitst...@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

Subclassing and private methods

2014-05-07 Thread Rick Aurbach
I am using a CocoaPod that ALMOST does what I want it to. It appears that I can 
get the desired behaviors by subclassing it (creating a category is also a 
possibility, although doing so has the same problems as subclassing).

Obviously, I would like to create as minimal a subclass as possible (and 
avoiding duplicating existing code), but doing so requires access to private 
methods of the original object. The problem is that I need to use methods which 
are not declared outside of the @implementation section of the class and a 
property which is ONLY declared in the class’s anonymous category interface 
(i.e., @interface theClass ()  … @end)..

Now I understand that trying to gain access to private methods is generally a 
BAD IDEA, since almost any change to the original CocoaPod could break my 
class. And I may (i.e., probably will) resolve the issue by duplicating 
otherwise unnecessary code in my subclass. But before I do so, I’d like to 
survey what people think, how they approach this problem, etc.

(This is sort of like the undefined selector issue that has been discussed 
recently, but seems to me to be a slightly different wrinkle.)

What do you do??

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: Serializing NSDictionary for network transfer

2014-05-07 Thread Carl Hoefs
On May 7, 2014, at 12:06 PM, Alex Zavatone  wrote:

> If your dictionary has only text values, this should be no problem with the 
> NSJSONSerialization, but if you're sending images, you'll need to convert the 
> images to 16 bit encoded NSData objects.
> 
> I guess the bigger question is, "what are the data types within your 
> dictionary"?
> 
> If it's just text, then you should have good luck with NSJSONSerialization.
> 
> Another question is, "where are you sending that data to?"  What type of 
> service will receive it?
> 
For the moment, I'm using only NSStrings and NSNumbers. I'm sending data back 
and forth between OSX and iOS devices, and NSDictionary is a very convenient 
container. Once I show that this will work then the pressure will ease off and 
I'll have time dig into more generalized ways (NSPropertyListSerialization?), 
ensuring things won't break in the future when requirements and use cases 
change. I just wasn't prepared going into this for the steep learning curve for 
what I assumed was a more or less trivial data serialization function. The 
documentation (which, yes, I have read but still can't make much sense of) 
documents but doesn't educate very well. I'm still a bit overwhelmed by the 
sometimes huge generalized mechanisms required to do things the Cocoa way, but 
I will overcome that with time and effort.

-Carl


___

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

Please do not post 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: Subclassing and private methods

2014-05-07 Thread Charles Srstka
On May 7, 2014, at 2:24 PM, Rick Aurbach  wrote:

> I am using a CocoaPod that ALMOST does what I want it to. It appears that I 
> can get the desired behaviors by subclassing it (creating a category is also 
> a possibility, although doing so has the same problems as subclassing).
> 
> Obviously, I would like to create as minimal a subclass as possible (and 
> avoiding duplicating existing code), but doing so requires access to private 
> methods of the original object. The problem is that I need to use methods 
> which are not declared outside of the @implementation section of the class 
> and a property which is ONLY declared in the class’s anonymous category 
> interface (i.e., @interface theClass ()  … @end)..
> 
> Now I understand that trying to gain access to private methods is generally a 
> BAD IDEA, since almost any change to the original CocoaPod could break my 
> class. And I may (i.e., probably will) resolve the issue by duplicating 
> otherwise unnecessary code in my subclass. But before I do so, I’d like to 
> survey what people think, how they approach this problem, etc.
> 
> (This is sort of like the undefined selector issue that has been discussed 
> recently, but seems to me to be a slightly different wrinkle.)
> 
> What do you do??

Is the superclass your code? If it is, just move the class extension (i.e. 
@interface MyClass () ... @end) to a separate file named MyClassPrivate.h, add 
declarations for any private methods the subclass needs to call, and have the 
subclass import that.

If the superclass is not your code, then it's best to find a way to do what you 
need without calling the private methods.

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: Subclassing and private methods

2014-05-07 Thread Rick Aurbach
On May 7, 2014, at 2:33 PM, Charles Srstka  wrote:

> On May 7, 2014, at 2:24 PM, Rick Aurbach  wrote:
> 
>> I am using a CocoaPod that ALMOST does what I want it to. It appears that I 
>> can get the desired behaviors by subclassing it (creating a category is also 
>> a possibility, although doing so has the same problems as subclassing).
>> 
>> Obviously, I would like to create as minimal a subclass as possible (and 
>> avoiding duplicating existing code), but doing so requires access to private 
>> methods of the original object. The problem is that I need to use methods 
>> which are not declared outside of the @implementation section of the class 
>> and a property which is ONLY declared in the class’s anonymous category 
>> interface (i.e., @interface theClass ()  … @end)..
>> 
>> Now I understand that trying to gain access to private methods is generally 
>> a BAD IDEA, since almost any change to the original CocoaPod could break my 
>> class. And I may (i.e., probably will) resolve the issue by duplicating 
>> otherwise unnecessary code in my subclass. But before I do so, I’d like to 
>> survey what people think, how they approach this problem, etc.
>> 
>> (This is sort of like the undefined selector issue that has been discussed 
>> recently, but seems to me to be a slightly different wrinkle.)
>> 
>> What do you do??
> 
> Is the superclass your code? If it is, just move the class extension (i.e. 
> @interface MyClass () ... @end) to a separate file named MyClassPrivate.h, 
> add declarations for any private methods the subclass needs to call, and have 
> the subclass import that.
> 
> If the superclass is not your code, then it's best to find a way to do what 
> you need without calling the private methods.

Thank you Charles. I agree with both of your thoughts. (I.e., I had considered 
the private interface file and your second point is exactly why I pointed out 
that it was probably a bad idea…

You help confirm my own thinking on this.

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: Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Jerry Krinock

On 2014 May 07, at 05:27, Jakob Egger  wrote:

> I have a NSTableView that spans the full width of the window, so it touches 
> the window borders on both sides. The table view has many columns (it scrolls 
> horizontally).
> 
> Changing column witdth columns by dragging the separator line works 
> perfectly, except for the last column. The problem is that the separator line 
> coincides with the window border, so when I try to drag it the window is 
> resized, rather than the column.
> 
> Did anybody else stumble upon this problem?

I have a window with a NSTableView that goes all the way to the right edge, and 
don’t have this problem.  The last column is never allowed to go to zero width. 
 To demonstrate this, activate Safari and look at the table (outline) view in 
menu > Bookmarks > Show All Bookmarks.


___

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

Please do not post 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: NSNumberFormatter 10.0+ style exception with zero

2014-05-07 Thread Howard Moon
Hm, it may be that something else is at play here.  I did make ONE change when 
porting… I put my text fields inside a tab view.  I wonder if maybe there's a 
problem accessing the number formatter from a control inside a tab view?  All 
the connections *appear* to be there, and the call stack does show that it's 
accessing an NSNumberFormatter (and there's only on in my project).  Need to 
run a test...

Ok… I just tested the same code using the OLD xib, WITHOUT the tab view, and it 
works with no problems!

So… does anyone know if simply adding a (two-tab) tab view and dragging 
existing objects on its pages causes any problems like this? Is there a 
connection I've overlooked that I need to make once the objects are inside that 
tab view?

Thanks,
-Howard

On May 7, 2014, at 9:34 AM, Howard Moon  wrote:

> Hi,
> 
>   is the 10.0+ style of NSNumberFormatter no longer supported?  I 
> recently moved from developing in Xcode3 under OS X 10.7 to Xcode 4 under OS 
> X 10.8, and from having a Base SDK of 10.6 to 10.7, and from a Deployment 
> Target of 10.5 to 10.6, and am now having problems with my xib-base 
> NSTextFields connected to an NSNumberFormatter.  The formatter uses the 10.0+ 
> style, allowing me to set the "Zero" field, which I am setting to the string 
> N/A.  This worked fine, even when running in 10.8 or 10.9, but crashes now 
> that I've compiled under these new conditions.
> 
> Here is the call stack when the exception is thrown:
> 
> 2014-05-07 08:32:15.225 Cubase 7.5[947:707] -[__NSCFString string]: 
> unrecognized selector sent to instance 0x1050188d0
> 2014-05-07 08:32:15.226 Cubase 7.5[947:707] NSInvalidArgumentException - 
> -[__NSCFString string]: unrecognized selector sent to instance 0x1050188d0
> 0   CoreFoundation  0x7fff92b32aee 
> __exceptionPreprocess + 174
> 1   libobjc.A.dylib 0x7fff8b8b13f0 
> objc_exception_throw + 43
> 2   CoreFoundation  0x7fff92bc940a 
> -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
> 3   CoreFoundation  0x7fff92b2102e ___forwarding___ + 
> 414
> 4   CoreFoundation  0x7fff92b20e18 
> _CF_forwarding_prep_0 + 232
> 5   Foundation  0x7fff93bc592b 
> -[NSNumberFormatter(NSNumberFormatterCompatibility2) 
> __oldnf_stringForObjectValue:] + 192
> 6   AppKit  0x7fff8bd2ba93 -[NSCell 
> _stringForEditing] + 83
> 7   AppKit  0x7fff8bd35a32 -[NSCell 
> _skipsSynchronizationForEditingTextView:] + 34
> 8   AppKit  0x7fff8bc5e43f -[NSCell 
> setObjectValue:] + 296
> 9   AppKit  0x7fff8bc5e2fd -[NSTextFieldCell 
> setObjectValue:] + 43
> 10  AppKit  0x7fff8be51cbd -[NSCell 
> _setIntegerValue:] + 196
> 11  AppKit  0x7fff8be47f49 -[NSControl 
> setIntValue:] + 138
> ...
> 
> I am simply calling setIntValue with a value of 0, which in previous builds 
> would set the text field's text to "N/A".  But now this exception is thrown, 
> and I don't know why or what to do about it.  If the 10.0 style of 
> NSNumberFormatter is no longer supported, why is it still available in Xcode 
> 4, and why does it compile and run, up to the point I set its value to 0?
> 
> Thanks,
>   -Howard
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/howard%40antarestech.com
> 
> This email sent to how...@antarestech.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: Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Jakob Egger
The problem only occurs when you have many columns and the table view
scrolls horizontally. Then you can't make the last column wider.
Dragging the left side only makes the second-to-last column narrower,
and dragging the right side resizes the window.


On Wed, May 7, 2014, at 22:16, Jerry Krinock wrote:
> 
> On 2014 May 07, at 05:27, Jakob Egger  wrote:
> 
> > I have a NSTableView that spans the full width of the window, so it touches 
> > the window borders on both sides. The table view has many columns (it 
> > scrolls horizontally).
> > 
> > Changing column witdth columns by dragging the separator line works 
> > perfectly, except for the last column. The problem is that the separator 
> > line coincides with the window border, so when I try to drag it the window 
> > is resized, rather than the column.
> > 
> > Did anybody else stumble upon this problem?
> 
> I have a window with a NSTableView that goes all the way to the right
> edge, and don’t have this problem.  The last column is never allowed to
> go to zero width.  To demonstrate this, activate Safari and look at the
> table (outline) view in menu > Bookmarks > Show All Bookmarks.
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/jakob%40eggerapps.at
> 
> This email sent to ja...@eggerapps.at

___

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

Please do not post 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: Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Quincey Morris
On May 7, 2014, at 13:55 , Jakob Egger  wrote:

> The problem only occurs when you have many columns and the table view
> scrolls horizontally. Then you can't make the last column wider.
> Dragging the left side only makes the second-to-last column narrower,
> and dragging the right side resizes the window.

So where is the right edge of the rightmost visible column? If you haven’t done 
anything special, then it could be at the window’s edge, or it could be further 
to the right, scrolled off the window, depending on the column width. I don’t 
see how the user would know the difference. Wouldn’t a user scroll the rest of 
the column into the window first, stopping only after the vertical line in the 
header row is clearly inside the window? If that’s the case, I don’t see that 
you really have a problem.

If you’re somehow adjusting the table (either the column widths or the amount 
of scroll) so that the rightmost visible column always ends at the window edge, 
then I’d suggest changing your algorithm so that it ends maybe 4-10 points 
inside the edge. That would solve the problem too, wouldn’t it?

___

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

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

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

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

Re: NSNumberFormatter 10.0+ style exception with zero

2014-05-07 Thread Howard Moon
Ok, this seems to be an IB issue.  I've made my own NSNumberFormatter, set its 
properties, and set it as the formatter for my text fields, all in code, and 
that works perfectly.  No idea why the same object created in Xcode fails, but 
I'll do whatever it takes to make it work, I guess!

Regards,
Howard


On May 7, 2014, at 1:47 PM, Howard Moon  wrote:

> Hm, it may be that something else is at play here.  I did make ONE change 
> when porting… I put my text fields inside a tab view.  I wonder if maybe 
> there's a problem accessing the number formatter from a control inside a tab 
> view?  All the connections *appear* to be there, and the call stack does show 
> that it's accessing an NSNumberFormatter (and there's only on in my project). 
>  Need to run a test...
> 
> Ok… I just tested the same code using the OLD xib, WITHOUT the tab view, and 
> it works with no problems!
> 
> So… does anyone know if simply adding a (two-tab) tab view and dragging 
> existing objects on its pages causes any problems like this? Is there a 
> connection I've overlooked that I need to make once the objects are inside 
> that tab view?
> 
> Thanks,
>   -Howard
> 
> On May 7, 2014, at 9:34 AM, Howard Moon  wrote:
> 
>> Hi,
>> 
>>  is the 10.0+ style of NSNumberFormatter no longer supported?  I 
>> recently moved from developing in Xcode3 under OS X 10.7 to Xcode 4 under OS 
>> X 10.8, and from having a Base SDK of 10.6 to 10.7, and from a Deployment 
>> Target of 10.5 to 10.6, and am now having problems with my xib-base 
>> NSTextFields connected to an NSNumberFormatter.  The formatter uses the 
>> 10.0+ style, allowing me to set the "Zero" field, which I am setting to the 
>> string N/A.  This worked fine, even when running in 10.8 or 10.9, but 
>> crashes now that I've compiled under these new conditions.
>> 
>> Here is the call stack when the exception is thrown:
>> 
>> 2014-05-07 08:32:15.225 Cubase 7.5[947:707] -[__NSCFString string]: 
>> unrecognized selector sent to instance 0x1050188d0
>> 2014-05-07 08:32:15.226 Cubase 7.5[947:707] NSInvalidArgumentException - 
>> -[__NSCFString string]: unrecognized selector sent to instance 0x1050188d0
>> 0   CoreFoundation  0x7fff92b32aee 
>> __exceptionPreprocess + 174
>> 1   libobjc.A.dylib 0x7fff8b8b13f0 
>> objc_exception_throw + 43
>> 2   CoreFoundation  0x7fff92bc940a 
>> -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
>> 3   CoreFoundation  0x7fff92b2102e ___forwarding___ 
>> + 414
>> 4   CoreFoundation  0x7fff92b20e18 
>> _CF_forwarding_prep_0 + 232
>> 5   Foundation  0x7fff93bc592b 
>> -[NSNumberFormatter(NSNumberFormatterCompatibility2) 
>> __oldnf_stringForObjectValue:] + 192
>> 6   AppKit  0x7fff8bd2ba93 -[NSCell 
>> _stringForEditing] + 83
>> 7   AppKit  0x7fff8bd35a32 -[NSCell 
>> _skipsSynchronizationForEditingTextView:] + 34
>> 8   AppKit  0x7fff8bc5e43f -[NSCell 
>> setObjectValue:] + 296
>> 9   AppKit  0x7fff8bc5e2fd -[NSTextFieldCell 
>> setObjectValue:] + 43
>> 10  AppKit  0x7fff8be51cbd -[NSCell 
>> _setIntegerValue:] + 196
>> 11  AppKit  0x7fff8be47f49 -[NSControl 
>> setIntValue:] + 138
>> ...
>> 
>> I am simply calling setIntValue with a value of 0, which in previous builds 
>> would set the text field's text to "N/A".  But now this exception is thrown, 
>> and I don't know why or what to do about it.  If the 10.0 style of 
>> NSNumberFormatter is no longer supported, why is it still available in Xcode 
>> 4, and why does it compile and run, up to the point I set its value to 0?
>> 
>> Thanks,
>>  -Howard
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/howard%40antarestech.com
>> 
>> This email sent to how...@antarestech.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/howard%40antarestech.com
> 
> This email sent to how...@antarestech.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 

Re: Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Avery Pierce
>
> Wouldn’t a user scroll the rest of the column into the window first,
> stopping only after the vertical line in the header row is clearly inside
> the window?


If I'm understanding Jakob's issue, the table view doesn't scroll more than
it needs to, so the rightmost column divider is exactly at the edge of the
window. It can never be scrolled inside.

Jakob, are you sure that the table view isn't 1 or 2 points too large? Have
you considered throwing in an extra, blank column at the end with a small
fixed width (5px maybe)?


On Wed, May 7, 2014 at 4:06 PM, Quincey Morris <
quinceymor...@rivergatesoftware.com> wrote:

> On May 7, 2014, at 13:55 , Jakob Egger  wrote:
>
> > The problem only occurs when you have many columns and the table view
> > scrolls horizontally. Then you can't make the last column wider.
> > Dragging the left side only makes the second-to-last column narrower,
> > and dragging the right side resizes the window.
>
> So where is the right edge of the rightmost visible column? If you haven’t
> done anything special, then it could be at the window’s edge, or it could
> be further to the right, scrolled off the window, depending on the column
> width. I don’t see how the user would know the difference. Wouldn’t a user
> scroll the rest of the column into the window first, stopping only after
> the vertical line in the header row is clearly inside the window? If that’s
> the case, I don’t see that you really have a problem.
>
> If you’re somehow adjusting the table (either the column widths or the
> amount of scroll) so that the rightmost visible column always ends at the
> window edge, then I’d suggest changing your algorithm so that it ends maybe
> 4-10 points inside the edge. That would solve the problem too, wouldn’t it?
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/aapierce0%40gmail.com
>
> This email sent to aapier...@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: NSNumberFormatter 10.0+ style exception with zero

2014-05-07 Thread Gary L. Wade
There are occasional bugs when converting from earlier formats. What I do 
besides reporting the bug is to look at the underlying XML in the earlier 
version of the XIB and the later version and try to manually make the necessary 
changes using a text editor. I've sometimes had to quit Xcode, edit the XIB, 
lock the XIB so Xcode won't change it, and then relaunch Xcode. You may not 
have to go that far, but I wouldn't doubt that support for pre-10.4 number 
formatters to be lost in test for later-XIB formats.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On May 7, 2014, at 2:37 PM, Howard Moon  wrote:
> 
> Ok, this seems to be an IB issue.  I've made my own NSNumberFormatter, set 
> its properties, and set it as the formatter for my text fields, all in code, 
> and that works perfectly.  No idea why the same object created in Xcode 
> fails, but I'll do whatever it takes to make it work, I guess!
> 
> Regards,
>Howard
> 
> 
>> On May 7, 2014, at 1:47 PM, Howard Moon  wrote:
>> 
>> Hm, it may be that something else is at play here.  I did make ONE change 
>> when porting… I put my text fields inside a tab view.  I wonder if maybe 
>> there's a problem accessing the number formatter from a control inside a tab 
>> view?  All the connections *appear* to be there, and the call stack does 
>> show that it's accessing an NSNumberFormatter (and there's only on in my 
>> project).  Need to run a test...
>> 
>> Ok… I just tested the same code using the OLD xib, WITHOUT the tab view, and 
>> it works with no problems!
>> 
>> So… does anyone know if simply adding a (two-tab) tab view and dragging 
>> existing objects on its pages causes any problems like this? Is there a 
>> connection I've overlooked that I need to make once the objects are inside 
>> that tab view?
>> 
>> Thanks,
>>-Howard
>> 
>>> On May 7, 2014, at 9:34 AM, Howard Moon  wrote:
>>> 
>>> Hi,
>>> 
>>>is the 10.0+ style of NSNumberFormatter no longer supported?  I recently 
>>> moved from developing in Xcode3 under OS X 10.7 to Xcode 4 under OS X 10.8, 
>>> and from having a Base SDK of 10.6 to 10.7, and from a Deployment Target of 
>>> 10.5 to 10.6, and am now having problems with my xib-base NSTextFields 
>>> connected to an NSNumberFormatter.  The formatter uses the 10.0+ style, 
>>> allowing me to set the "Zero" field, which I am setting to the string N/A.  
>>> This worked fine, even when running in 10.8 or 10.9, but crashes now that 
>>> I've compiled under these new conditions.
>>> 
>>> Here is the call stack when the exception is thrown:
>>> 
>>> 2014-05-07 08:32:15.225 Cubase 7.5[947:707] -[__NSCFString string]: 
>>> unrecognized selector sent to instance 0x1050188d0
>>> 2014-05-07 08:32:15.226 Cubase 7.5[947:707] NSInvalidArgumentException - 
>>> -[__NSCFString string]: unrecognized selector sent to instance 0x1050188d0
>>> 0   CoreFoundation  0x7fff92b32aee 
>>> __exceptionPreprocess + 174
>>> 1   libobjc.A.dylib 0x7fff8b8b13f0 
>>> objc_exception_throw + 43
>>> 2   CoreFoundation  0x7fff92bc940a 
>>> -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
>>> 3   CoreFoundation  0x7fff92b2102e ___forwarding___ 
>>> + 414
>>> 4   CoreFoundation  0x7fff92b20e18 
>>> _CF_forwarding_prep_0 + 232
>>> 5   Foundation  0x7fff93bc592b 
>>> -[NSNumberFormatter(NSNumberFormatterCompatibility2) 
>>> __oldnf_stringForObjectValue:] + 192
>>> 6   AppKit  0x7fff8bd2ba93 -[NSCell 
>>> _stringForEditing] + 83
>>> 7   AppKit  0x7fff8bd35a32 -[NSCell 
>>> _skipsSynchronizationForEditingTextView:] + 34
>>> 8   AppKit  0x7fff8bc5e43f -[NSCell 
>>> setObjectValue:] + 296
>>> 9   AppKit  0x7fff8bc5e2fd 
>>> -[NSTextFieldCell setObjectValue:] + 43
>>> 10  AppKit  0x7fff8be51cbd -[NSCell 
>>> _setIntegerValue:] + 196
>>> 11  AppKit  0x7fff8be47f49 -[NSControl 
>>> setIntValue:] + 138
>>> ...
>>> 
>>> I am simply calling setIntValue with a value of 0, which in previous builds 
>>> would set the text field's text to "N/A".  But now this exception is 
>>> thrown, and I don't know why or what to do about it.  If the 10.0 style of 
>>> NSNumberFormatter is no longer supported, why is it still available in 
>>> Xcode 4, and why does it compile and run, up to the point I set its value 
>>> to 0?
>>> 
>>> Thanks,
>>>-Howard
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post 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/howard%40antarestech.c

Re: Resizing last column of NSTableView when it touches window border

2014-05-07 Thread Quincey Morris
On May 7, 2014, at 14:42 , Avery Pierce  wrote:

> If I'm understanding Jakob's issue, the table view doesn't scroll more than 
> it needs to, so the rightmost column divider is exactly at the edge of the 
> window. It can never be scrolled inside.

You’re right. He said “rightmost column” and I read “rightmost visible column”.

Personally, I think that the ambiguity (of what’s being resize) is a small UI 
defect. Discriminating the two cases may actually make for a poorer UI 
experience. We don’t know the exact circumstances, but avoiding having the last 
column being resizable seems like a better outcome, if there’s a way of doing 
it.

> Have you considered throwing in an extra, blank column at the end with a 
> small fixed width (5px maybe)?

I think that would be reasonable, too. It’s kind of a variation of the previous 
suggestion.

Looking at Finder windows in column view, I see that it’s able to discriminate 
column resizing from window resizing when the last column ends at the edge of 
the window (though it’s not always clear that the correct cursor is displayed). 
But it’s really hard to tell exactly where the mouse is pointing, since pixels 
are mostly pretty small these days.

___

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

Please do not post 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: Document being reopened on launch during modal dialog

2014-05-07 Thread Mills, Steve
On May 6, 2014, at 19:05:22, Graham Cox  wrote:

> The compromise we've adopted is to let all the documents open as normal 
> *then* show the dialog if necessary on top of them. That avoids the need to 
> capture the 'open' URLs, but it's only OK if you can accept the documents 
> being there - in our case we can. Doing this is fairly simple though - just 
> invoke the dialog opening method after a short delay (1 second in our case) - 
> it's enough to ensure it happens after all doc opening has completed, since 
> the true main event loop runs normally, opens the documents, then processes 
> any pending 'perform after delay' stuff.

I got something working and just wanted to run it by y'all. When the 
cross-platform init code gets an error, I call a cross-platform function. The 
Mac build of this function allocates an NSObject subclass and tells it to 
execute later in the main run loop like so:

RunPlogueModalsInMainEventLoop* runner = 
[[RunPlogueModalsInMainEventLoop alloc] 
initForProblem:PlogueProblem::kEngineFailed error:errCode];

[runner performSelectorOnMainThread:@selector(runDlog) 
withObject:runner waitUntilDone:NO modes:[NSArray 
arrayWithObjects:NSDefaultRunLoopMode, nil]];

That object's runDlog method then runs our cross-platform dlog and releases the 
Obj-C object (self):

-(void) runDlog
{
// Simplified for clarity:
fcdlg::PlogueEngineFailErrordlg(NULLP, self->error);

dlg.DoModal();

// We're all done with this allocated object:
[self release];
}

Is this all safe and legal, releasing self right before it returns to whatever 
called it?

--
Steve Mills
office: 952-818-3871
home: 952-401-6255


___

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

Please do not post 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: Serializing NSDictionary for network transfer

2014-05-07 Thread Manoah F. Adams

On May 7, 2014, at 12:30 , Carl Hoefs wrote:

For the moment, I'm using only NSStrings and NSNumbers. I'm sending  
data back and forth between OSX and iOS devices, and NSDictionary  
is a very convenient container. Once I show that this will work  
then the pressure will ease off and I'll have time dig into more  
generalized ways (NSPropertyListSerialization?), ensuring things  
won't break in the future when requirements and use cases change. I  
just wasn't prepared going into this for the steep learning curve  
for what I assumed was a more or less trivial data serialization  
function. The documentation (which, yes, I have read but still  
can't make much sense of) documents but doesn't educate very well.  
I'm still a bit overwhelmed by the sometimes huge generalized  
mechanisms required to do things the Cocoa way, but I will overcome  
that with time and effort.


-Carl




Hi,

If you are going Cocoa to Cocoa, and simple data types,  
NSPropertyListSerialization should work.

I use it all the time for reading and writing to disk.

here's an adaptation...

/* transfer out */
NSDictionary* dictionaryToTransfer; // <- set this to your input  
dictionary

NSString* err;
NSData* data = [NSPropertyListSerialization  
dataFromPropertyList:dictionaryToTransfer
  format:NSPropertyListBinaryFormat_v1_0  // or  
NSPropertyListXMLFormat_v1_0

errorDescription:&err];
// now send the data



/* receive */
NSString* err;
NSData* data; // <- set this to your input data from the transfer
NSDictionary* dictionaryToReceive = [NSPropertyListSerialization  
propertyListFromData:data


mutabilityOption:NSPropertyListImmutable
		format:NULL // NSPropertyListSerialization determines for itself if  
the input was as text or as binary.

errorDescription:&err];



You can also use the same procedure for any other property-list  
object (NSArray, NSString, NSNumber, etc.).
(Also check for and adapt the newer api's  
(dataWithPropertyList:format:options:error:   for instance) ).



Manoah F. Adams

This message is signed with a certificate and-or PGP key.
Disregard any unverified messages from this address.
===






smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: NSWorkspace issue

2014-05-07 Thread Varun Chandramohan
Ah yes, that was the mistake. I did not notice it. Probably its always a
good idea to use fileURLWithPath as I always deal with file urls and not
http://.


On 7/05/2014 3:58 pm, "Ken Thomases"  wrote:

>On May 7, 2014, at 12:02 AM, Varun Chandramohan wrote:
>
>>NSURL *fileURL = [NSURL
>>URLWithString:@"/Users/usr/Desktop/libd.dylib"];
>
>This is not correct.  +[NSURL URLWithString:] expects a valid URL string.
> What you're providing is a file path string, which is not a URL string.
>A URL string might be "http://www.apple.com"; or
>"file:///Users/usr/Desktop/libd.dylib".  However, never just prepend
>"file://" to a file path to try to make it into a URL string.  That
>doesn't correctly handle a path which contains characters which are not
>valid in URLs.
>
>The correct thing to do is use +[NSURL fileURLWithPath:] or a similar
>method.
>
>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: NSNumberFormatter 10.0+ style exception with zero

2014-05-07 Thread Greg Parker
The implementation of old-style NSNumberFormatter has some sort of 
compatibility code for old archive formats. It's possible that new versions of 
Xcode don't write that old format correctly, or even try to do it at all.

(The error occurs because the Zero field came back as an NSString instead of an 
NSAttributedString, and the code wasn't expecting that.)

Can you switch to the new-style NSNumberFormatter now? The new-style 
NSNumberFormatter's zeroSymbol didn't work in 10.4 itself but should work in 
later OS versions.


On May 7, 2014, at 2:51 PM, Gary L. Wade  wrote:

> There are occasional bugs when converting from earlier formats. What I do 
> besides reporting the bug is to look at the underlying XML in the earlier 
> version of the XIB and the later version and try to manually make the 
> necessary changes using a text editor. I've sometimes had to quit Xcode, edit 
> the XIB, lock the XIB so Xcode won't change it, and then relaunch Xcode. You 
> may not have to go that far, but I wouldn't doubt that support for pre-10.4 
> number formatters to be lost in test for later-XIB formats.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>> On May 7, 2014, at 2:37 PM, Howard Moon  wrote:
>> 
>> Ok, this seems to be an IB issue.  I've made my own NSNumberFormatter, set 
>> its properties, and set it as the formatter for my text fields, all in code, 
>> and that works perfectly.  No idea why the same object created in Xcode 
>> fails, but I'll do whatever it takes to make it work, I guess!
>> 
>> Regards,
>>   Howard
>> 
>> 
>>> On May 7, 2014, at 1:47 PM, Howard Moon  wrote:
>>> 
>>> Hm, it may be that something else is at play here.  I did make ONE change 
>>> when porting… I put my text fields inside a tab view.  I wonder if maybe 
>>> there's a problem accessing the number formatter from a control inside a 
>>> tab view?  All the connections *appear* to be there, and the call stack 
>>> does show that it's accessing an NSNumberFormatter (and there's only on in 
>>> my project).  Need to run a test...
>>> 
>>> Ok… I just tested the same code using the OLD xib, WITHOUT the tab view, 
>>> and it works with no problems!
>>> 
>>> So… does anyone know if simply adding a (two-tab) tab view and dragging 
>>> existing objects on its pages causes any problems like this? Is there a 
>>> connection I've overlooked that I need to make once the objects are inside 
>>> that tab view?
>>> 
>>> Thanks,
>>>   -Howard
>>> 
 On May 7, 2014, at 9:34 AM, Howard Moon  wrote:
 
 Hi,
 
   is the 10.0+ style of NSNumberFormatter no longer supported?  I recently 
 moved from developing in Xcode3 under OS X 10.7 to Xcode 4 under OS X 
 10.8, and from having a Base SDK of 10.6 to 10.7, and from a Deployment 
 Target of 10.5 to 10.6, and am now having problems with my xib-base 
 NSTextFields connected to an NSNumberFormatter.  The formatter uses the 
 10.0+ style, allowing me to set the "Zero" field, which I am setting to 
 the string N/A.  This worked fine, even when running in 10.8 or 10.9, but 
 crashes now that I've compiled under these new conditions.
 
 Here is the call stack when the exception is thrown:
 
 2014-05-07 08:32:15.225 Cubase 7.5[947:707] -[__NSCFString string]: 
 unrecognized selector sent to instance 0x1050188d0
 2014-05-07 08:32:15.226 Cubase 7.5[947:707] NSInvalidArgumentException - 
 -[__NSCFString string]: unrecognized selector sent to instance 0x1050188d0
 0   CoreFoundation  0x7fff92b32aee 
 __exceptionPreprocess + 174
 1   libobjc.A.dylib 0x7fff8b8b13f0 
 objc_exception_throw + 43
 2   CoreFoundation  0x7fff92bc940a 
 -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
 3   CoreFoundation  0x7fff92b2102e 
 ___forwarding___ + 414
 4   CoreFoundation  0x7fff92b20e18 
 _CF_forwarding_prep_0 + 232
 5   Foundation  0x7fff93bc592b 
 -[NSNumberFormatter(NSNumberFormatterCompatibility2) 
 __oldnf_stringForObjectValue:] + 192
 6   AppKit  0x7fff8bd2ba93 -[NSCell 
 _stringForEditing] + 83
 7   AppKit  0x7fff8bd35a32 -[NSCell 
 _skipsSynchronizationForEditingTextView:] + 34
 8   AppKit  0x7fff8bc5e43f -[NSCell 
 setObjectValue:] + 296
 9   AppKit  0x7fff8bc5e2fd 
 -[NSTextFieldCell setObjectValue:] + 43
 10  AppKit  0x7fff8be51cbd -[NSCell 
 _setIntegerValue:] + 196
 11  AppKit  0x7fff8be47f49 -[NSControl 
 setIntValue:] + 138
 ...
 
 I am simply calling setIntValue with a value of 0, which in previous 
 builds would set the text field's text to "N/A".  But now this e

Re: Document being reopened on launch during modal dialog

2014-05-07 Thread Quincey Morris
On May 7, 2014, at 15:08 , Mills, Steve  wrote:

> Is this all safe and legal, releasing self right before it returns to 
> whatever called it?

I believe it’s safe in manual RR, though you could perhaps do ‘[self 
autorelease]’ if you feel uncertain. I’m not sure it’d be safe under ARC (that 
is, doing something that could cause ‘self’ to be deallocated), because ARC 
might have epilogue code at the end of the scope, and that *might* refer to 
self.

However, it’s probably safe for a different reason. ‘performSelector’ should 
retain its receiver, and presumably won’t release it until after the performed 
method returns, so your ‘[self release]’ presumably won’t actually result in 
deallocation.

___

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

Please do not post 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: Document being reopened on launch during modal dialog

2014-05-07 Thread Graham Cox

On 8 May 2014, at 8:08 am, Mills, Steve  wrote:

> Is this all safe and legal, releasing self right before it returns to 
> whatever called it?


I believe so, I've done this rarely but occasionally, and it's OK, though if 
you forget you've done this and later change the calling behaviour in such a 
way that you assume the object is still there on return from -runDlog it will 
crash.

If you want to be safer, you could use -autorelease instead, which will allow 
it to live a little longer, until the call stack to this point has unwound and 
returned to the main loop.

There are probably also better ways to set this up in general, such that the 
runner object is automatically disposed when it's done its job - for example 
using a block? I've just woken up, so off the top of my head I'm not ready to 
pinpoint the best approach.

--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: Document being reopened on launch during modal dialog

2014-05-07 Thread Kyle Sluder
> On May 7, 2014, at 5:07 PM, Quincey Morris 
>  wrote:
> 
> However, it’s probably safe for a different reason. ‘performSelector’ should 
> retain its receiver

Wait, why do you suspect this? Unless I missed something, there’s no guarantee, 
ARC or not, that a receiver will survive through a method invocation.

--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: Document being reopened on launch during modal dialog

2014-05-07 Thread Graham Cox

On 8 May 2014, at 10:39 am, Kyle Sluder  wrote:

> Wait, why do you suspect this? Unless I missed something, there’s no 
> guarantee, ARC or not, that a receiver will survive through a method 
> invocation.


How else could it work? -performSelector must hang on to the receiver at least 
until the method invocation, so any release must come afterwards, or an 
autorelease beforehand which means the release itself will be afterwards. If it 
was otherwise -performSelector would be crashing continually, which is not the 
behaviour observed.

--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: Help with Help

2014-05-07 Thread koko


On May 7, 2014, at 12:00 PM, Kirk  wrote:

> I further note that Apple's own iWork apps use online help pages that open in 
> Safari. 

We use HTML and open Safari when user selects help.  Great for our cross 
platform products.

-koko

___

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

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

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

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

Re: Help with Help

2014-05-07 Thread Cosmo
As somebody who did a lot of development work on early versions of Simple Help 
Editor, I’d like to point out a misstatement. It does not require one to write 
their own HTML. It does a quite capable job of translating styled text into 
HTML, but does offer the ability to handle custom HTML for things like tables, 
that don’t translate easily as styled text. I would agree that it can be a 
complex application if you want to get beyond the basics.

On May 7, 2014, at 10:08 AM, Gordon Apple  wrote:

> I then tried the $150 (limited free trial) SimpleHelpEditor. It¹s a lot more
> capable, but complex, and you end up having to write all the HTML yourself
> anyway, so why bother?


___

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

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