Re: Question on OS X app submission

2014-09-21 Thread Giacomo Tufano
> Any idea on my original question, though? If I have a helper app embedded in 
> my bundle, with a bundle ID of its own, does the app store need to know about 
> that bundle ID, or just the main one?

I have on app in the app store that auto-start. The App Store needs only to 
know about the “main app” bundle id. The helper app has to be signed, but Xcode 
took care of it automagically (surprisingly enough). Remember that the app 
cannot set automatically to autostart, the user must explicitly approve/set.
As you probably already know, you have to use SMLoginItemSetEnabled() to set 
the autostart thing, other methods don’t work for sandboxed app (cfr. 
).

HTH, 
gt

---
Giacomo Tufano
http://www.ilTofa.com/

Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. (S. 
Beckett)



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

Custom layout and constraints

2014-09-21 Thread Allan Odgaard
I am overriding `NSView`’s `layout` method to manually place one of my 
subviews.


I can set the frame for this subview, and it works until someone calls 
`layoutSubtreeIfNeeded` on the subview (which sometimes happens 
automatically during display).


The subview’s `needsLayout` property is `NO` but 
`layoutSubtreeIfNeeded` will still go ahead and change the frame.


The problem seems to be that `layoutSubtreeIfNeeded` calls 
`resizeWithOldSuperviewSize:` (using the containing view’s size), but 
regardless of what’s passed to the view, it’ll set the entire frame 
and using values from its constraints (falling back to zero if there 
isn’t any).


That is, if the view has hugging and/or intrinsic content size then the 
size from the derived constraints will be used, otherwise `NSZeroSize`. 
Likewise the origin will be `NSZeroPoint` unless constrains are added to 
affect the position.


So how can I ensure the position I set for a subview’s frame in my 
`layout` override is not (implicitly) changed later?


Worth mentioning that if I overload `resizeWithOldSuperviewSize:` like 
this:


- (void)resizeWithOldSuperviewSize:(NSSize)aSize
{
self.frame = (NSRect){ self.frame.origin, aSize };
}

Then my subview stays put, but the size can be changed. If I simply use 
an empty body in the `resizeWithOldSuperviewSize:` override, then I have 
not seen any issues with the frame of my custom laid out subview. But of 
course that is not an acceptable solution.

___

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: Custom layout and constraints

2014-09-21 Thread Kyle Sluder
On Sep 21, 2014, at 7:10 AM, Allan Odgaard  wrote:
> 
> 
> That is, if the view has hugging and/or intrinsic content size then the size 
> from the derived constraints will be used, otherwise `NSZeroSize`. Likewise 
> the origin will be `NSZeroPoint` unless constrains are added to affect the 
> position.
> 
> So how can I ensure the position I set for a subview’s frame in my `layout` 
> override is not (implicitly) changed later?

You need to turn on translatesAutoresizingMaskIntoConstraints for the subviews 
you position manually. That way Auto Layout knows how to position them.

I really view this as a bug. If a view has no constraints applied to it, the 
view should not be touched by Auto Layout at all. That was the implicit promise 
made to us by saying we could still perform manual layout in -layout. Breaking 
that promise has led to bugs where existing code that used -setFrame: would 
fail because it was handed a view that had translatesAutoresizingMask turned 
off at some point. It also means that any -setFrame:-based code triggers a 
recursive pass through the entire view hierarchy, which is exactly what you 
don’t want in any animation code that’s using -setFrame:.

You’re the third person on this mailing list in the past month to be bitten by 
this surprising behavior. I would suggest you file a Radar.

--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: return string that is the difference between two other strings

2014-09-21 Thread Jens Alfke

> On Sep 20, 2014, at 11:45 PM, Allan Odgaard  
> wrote:
> 
> If you need a C API then have a look at 
> https://code.google.com/p/google-diff-match-patch/ 
> 
This^^ looks like exactly what you want, 2551. The online demo is quite 
impressive:

https://neil.fraser.name/software/diff_match_patch/svn/trunk/demos/demo_diff.html
It compares on a character-by-character basis, not just by line, and the output 
shows the individual insertions/deletions/changes inline.

(I'm actually going to bookmark this myself; I have a side project that could 
make use of 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

Re: Question on OS X app submission

2014-09-21 Thread Jim Geist
I’m using SMLoginItemSetEnabled with the helper app. Thanks for the info!


> On Sep 21, 2014, at 1:11 AM, Giacomo Tufano  wrote:
> 
>> Any idea on my original question, though? If I have a helper app embedded in 
>> my bundle, with a bundle ID of its own, does the app store need to know 
>> about that bundle ID, or just the main one?
> 
> I have on app in the app store that auto-start. The App Store needs only to 
> know about the “main app” bundle id. The helper app has to be signed, but 
> Xcode took care of it automagically (surprisingly enough). Remember that the 
> app cannot set automatically to autostart, the user must explicitly 
> approve/set.
> As you probably already know, you have to use SMLoginItemSetEnabled() to set 
> the autostart thing, other methods don’t work for sandboxed app (cfr. 
> ).
> 
> HTH, 
> gt
> 
> ---
> Giacomo Tufano
> http://www.ilTofa.com/
> 
> Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. (S. 
> Beckett)
> 


___

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

restorableStateKeyPaths versus invalidateRestorableState

2014-09-21 Thread Daryle Walker
These are two methods in NSResponder and they deal with user-interface restore.

The docs say that +restorableStateKeyPaths can lead to not needing to use 
-encodeRestorableStateWithCoder: and -restoreStateWithCoder:. Since those 
key-path attributes are supposed to be watched with KVO, shouldn’t explicitly 
calling -invalidateRestorableState also be unnecessary (assuming full 
coverage)? Can anyone confirm?

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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: return string that is the difference between two other strings

2014-09-21 Thread Lee Ann Rucker
On 21 Sep 2014, at 13:03, Kyle Sluder  wrote:

>
>> No, it is nowhere near a common operation to perform on strings.


>I stand corrected on that front, then (apparently...). Doesn't change the fact 
>that I need to know how to do it, unless someone is willing to  point me in 
>the direction of a better way, for which I'd be most grateful.

>> It’s common for *programmers* to perform on their source code.
>

>I've no idea what this means. Is it a cryptic answer to the problem, or a dig 
>at my level of experience?

No, it's saying that while the people on this list - you included - may need 
the results of the operation frequently enough that it's a standard developer 
tool, it's not something that most of us ever need to add to the programs we 
write for non-programmers to use. It's a very specialised operation; the more 
you look into it, the more complicated it gets. Try getting a source-code diff 
tool to understand that you've moved an entire function, for instance.
___

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: Custom layout and constraints

2014-09-21 Thread Allan Odgaard

On 21 Sep 2014, at 16:44, Kyle Sluder wrote:

[…] how can I ensure the position I set for a subview’s frame in 
my `layout` override is not (implicitly) changed later?


You need to turn on translatesAutoresizingMaskIntoConstraints for the 
subviews you position manually. That way Auto Layout knows how to 
position them.


Thanks a lot for your quick answer, I think I got it all working now, 
although not without some further issues:


1. It seems my layout implementation must call [super layout] before 
*and* after I set my subview’s frame. If I do not call it afterwards, 
I get the “something may have dirtied layout in the middle of updating 
it” warning. Is this expected?


2. If I set translatesAutoresizingMaskIntoConstraints to YES then I 
effectively can’t use constraints involving the view. At least it 
seemed very prone to the “ambiguous layout” exception. Perhaps this 
is just a question of setting the proper autoresize mask? What I want is 
only to place and size my subview, but the subview itself contains views 
that ideally I would have the auto-layout system handle.


3. If allowsImplicitAnimation is enabled (layer-backed) and I read my 
subview’s frame property after having updated it, then I do not get 
back the value that I set, instead I get the interpolated value 
(original → new). I was under the impression that with wantsLayer set 
to YES only the layer tree contains the interpolated value, and the view 
holds the latest value. This is a problem for sub-sub-views that also 
have a layout override, as that method will use incorrect view bounds. 
My workaround was to layout the full subtree from the first view (in the 
view hierarchi) with a layout override.


4. If allowsImplicitAnimation is enabled then my custom layout 
implementation is called a dozen times after the first (true) layout 
pass. This is problematic because then I’ll do layout (again) and 
effectively suppress the animation (although only for views where I 
cause the frame size to change, it seems). My workaround for this was to 
introduce instance data to record the parameters used for the layout 
(like view bounds) and then check that in my layout override and only do 
my custom layout if the parameters have changed.

___

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: Custom layout and constraints

2014-09-21 Thread Ken Thomases
On Sep 21, 2014, at 9:10 AM, Allan Odgaard  wrote:

> I am overriding `NSView`’s `layout` method to manually place one of my 
> subviews.

> The problem seems to be that `layoutSubtreeIfNeeded` calls 
> `resizeWithOldSuperviewSize:` (using the containing view’s size), but 
> regardless of what’s passed to the view, it’ll set the entire frame and using 
> values from its constraints (falling back to zero if there isn’t any).

Does it still do that if the superview has autoresizesSubviews set to NO?

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: Writing, then reading JSON

2014-09-21 Thread Charles Jenkins
Just as a test, I changed my writer method to immediately try to interpret the 
JSON data and reconstitute the project’s data:

let structureDict = theProject.getStructureDictionary()  
let jsonData = NSJSONSerialization.dataWithJSONObject( structureDict, 
options: nil, error: outError )
if let reconstitutedStructureDict = NSJSONSerialization.JSONObjectWithData( 
jsonData!, options: nil, error: outError ) as? NSDictionary {
  var reconstitutedProj = 
DocumentNode.readFromWrapperViaStructureDictionary( parentWrapper: 
theFileWrapper!, dictionary: reconstitutedStructureDict )
}

All this works: reconstitutedStructureDict is a copy of structureDict, and 
reconstitutedProj is a copy of theProject. And the JSON file that gets written 
out appears okay, so my problem seems to be that 
NSFileWrapper.regularFileContents isn’t returning usable data.

—

Charles Jenkins


On Friday, September 19, 2014 at 11:45 AM, Charles Jenkins wrote:

> My document structure is a file wrapper containing a bunch of RTF documents 
> and a file called structure.json which describes how they relate to one 
> another.
>  
> I write out the structure file like this:
>  
> let structureDict = theProject.getStructureDictionary()  
> let jsonData = NSJSONSerialization.dataWithJSONObject( structureDict, 
> options: nil, error: outError )
>  
> writeFileToWrapper(  
>   parentWrapper: theFileWrapper!,
>   filename: structureFileName,
>   data: jsonData,
>   err: outError
> );
>  
>  
> I’m not including the bodies of getStructureDictionary() or 
> writeFileToWrapper() because they seem to work just fine. The structure.json 
> file appears in my output package, and if I open it using TextWrangler, I see 
> exactly the JSON content I expect, stored in UTF8 encoding.
>  
> The thing is, my app can’t read it back in. Here’s the function that’s not 
> working:
>  
>   override func readFromFileWrapper(  
> parentWrapper: NSFileWrapper!,
> ofType typeName: String!,
> error outError: NSErrorPointer
>   ) -> Bool
>   {
> if let fw = parentWrapper.fileWrappers[ structureFileName ] as? 
> NSFileWrapper {
>   if let data = fw.regularFileContents? {
> let debug: String = NSString( data: data, encoding: 
> NSUTF8StringEncoding )
> let obj: AnyObject? = NSJSONSerialization.JSONObjectWithData( data, 
> options: nil, error: outError )
> if let structureDict = obj as? NSDictionary {
>   var proj = DocumentNode.readFromWrapperViaStructureDictionary( 
> parentWrapper: parentWrapper, dictionary: structureDict )
>   theProject = proj
>   theFileWrapper = parentWrapper
>   return true
> }
>   }
> }
> return false;
>   }
>  
>  
> I expect I’ll find bugs in readFromWrapperViaStructureDictionary() if I ever 
> call it, but I never get that far.
>  
> With Swift and Xcode, stepping line-by-line through code it a bit confusing 
> because the current line indicator bounces all around, sometimes appearing on 
> lines of code already executed. But to be best of my belief, my problem is 
> that obj can’t be converted to an NSDictionary. I inserted the debug: String 
> to see what’s read from the file, and it comes back as garbage.
>  
> Is calling regularFileContents the wrong way to read up my JSON file?  
>  
> —
>  
> Charles Jenkins
>  

___

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

WebView and User Interface Restore

2014-09-21 Thread Daryle Walker
Do WebView instances participate in the Resume feature (with 
+restoreWindowWithIdentifier: state: completionHandler:, etc.), or do I have to 
manually handle their state (the web-view’s back-forward list and which item is 
current) myself?

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT 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

Database Access and Swift? (ODBC, native libraries)

2014-09-21 Thread Andrew Satori
Well folks, it's me again. Your slightly off kilter and sometimes obsessed with 
database stuff developer...

With the upcoming migration to Swift as the language of choice for OS X 
development, there is a decided lack of tools for getting from Cocoa to the 
RDBMS' of the world, and unfortunately they aren't moving to REST interfaces as 
quickly as many of us might wish. So...

What I am here asking is not how, I've already worked that out (and have 
started making that available). Instead, I am asking for opinions on a priority 
list.  In essence, I am looking for your votes on what you might want, in what 
order you want it, and if you are really feeling generous, how much you might 
be willing to pay for it. 

Over the last several years, I have built up the ODBCKit to get to any ODBC 
datasource, but it is an OS X tech, you cannot do ODBC on iOS. Because of that, 
we also have a very close sibling to provide native PostgreSQL support on 
either platform.  About a year ago, we put together an Objective C Protocol 
called GenDB that simply let us swap PGSQLKit for ODBCKit in the code. Over the 
last couple of months, this has been updated to support Swift.

What do we mean?  Consider the following:

//
//  main.swift
//  GenDBSwiftClient
//
//  Created by Andy Satori on 8/22/14.
//  Copyright (c) 2014 Druware Software Designs. All rights reserved.
//

import Foundation
import ODBCKit
import PGSQLKit

var connection: GenDBConnection;
connection = ODBCConnection();
connection.UserName = "sqluser";
connection.Password = "test";
connection.ConnectionString = "test"; // test can be any ODBC data source,
  // in this case it has been vetted against
  // all of the ActualTechnologies drivers.
if (!connection.connect())
{
println("Connection Failed");
println(connection.LastError);
connection.close();
} else {
println("Connected");

var rs: GenDBRecordset
rs = connection.open("select * from cases where status = 'A'")
while (!rs.isEOF())
{
println("CaseNumber: " + rs.fieldByName("casenumber").asString())
rs.moveNext()
}
rs.close()

connection.close();
}

var conn: GenDBConnection;
conn = PGSQLConnection();
conn.UserName = "postgres";
conn.Password = "test";
conn.ConnectionString = "host=localhost port=5432 dbname=postgres";
if (!conn.connect())
{
println("Connection Failed");
println(conn.LastError);
conn.close();
} else {
println("Connected");

var rs: GenDBRecordset
rs = conn.open("select * from cases where status = 'A'")
while (!rs.isEOF())
{
println("CaseNumber: " + rs.fieldByName("casenumber").asString())
rs.moveNext()
}
rs.close()

conn.close();
}
exit(0);

With that in mind, what I want to know is this. What RDBMS platforms do you all 
want native interfaces for the most, in what order, and at what value.

Tentatively, we are are working on the following:

1.  TDSSQLKit - MS SQL (including Azure) / Sybase SQL
2.  MySQLKit - MySQL
3.  OraKit - Oracle
4.  Other? 

In each case, the code will be made available under the appropriate OSS 
license. In the instances where the underlying code requires it, the license 
will be GPL, L/GPL or where possible our preferred BSD. Where possible, this 
will happen after a predetermined dollar amount in donations is reached ( we 
are currently tracking at $10k, per library ).  ODBCKit and PGSQLKit are 
already out there, and the newly renovated Swift code is in the SVN repos, 
though the binaries are not yet published.

S...

this is your chance to tell us what to work on next (assuming you read this 
far, and or care!)

Andy 'Dru' Satori




___

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

NSButton checkbox type with the disable color is not visible in Yosemite

2014-09-21 Thread Appa Rao Mulpuri
Hello List,

I have a background view with the black color. And on top of it, I’ve placed a 
Checkbox with the attributed title with the white color. In enabled mode, text 
is visible with the white color, but if I make the button to disabled mode 
(with setEnabled:NO) the text is not visible, only button with checkbox is 
displaying. Though text is there and because of black background it is not 
visible. Its happening only in Yosemite.

Any way to solve this? I have tried it with by sub-classing and overriding the 
setEnabled: method, but no luck.

Thanks,
Apparao Mulpuri
This email and any attachments are confidential, and may be legally privileged 
and protected by copyright. If you are not the intended recipient dissemination 
or copying of this email is prohibited. If you have received this in error, 
please notify the sender by replying by email and then delete the email 
completely from your system. Any views or opinions are solely those of the 
sender. This communication is not intended to form a binding contract unless 
expressly indicated to the contrary and properly authorised. Any actions taken 
on the basis of this email are at the recipient's own risk.
___

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