Re: NSTextView pagination

2016-07-07 Thread Graham Cox

> On 8 Jul 2016, at 2:42 AM, Jonathan Mitchell  wrote:
> 
> could supply a new view that would correspond to the new page orientation (if 
> I could get an appropriate   notification) but NSPrintOperation’s -view 
> is readonly.


Do it this way. The textview can share the same NSTextStorage as the GUI view.

When you create the NSPrintOperation, you pass it the view to use, so you can 
create the new view then, set its text storage and away it goes. It’s usually 
much easier to set up a separate printing view than trying to make a single 
view adapt itself to deal with both situations.

—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

Encoding of Swift string literals?

2016-07-07 Thread William Squires
Is it NSASCIIStringEncoding, or UTF8 (or something else)? Is it dependent on 
the system locale or language setting? (in my case, locale is US, and language 
is US English, with a US keyboard).

Also, do string literals in Swift still respect the '\' escape sequences, like 
in C?


___

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

WKWebView frame resizing doesn't animate WebGL frame resize

2016-07-07 Thread Rick Mann
I'm not sure if this is the right list for this. If not, please let me know a 
better place to post.

We have a WebGL-based viewer for our 3D content. For the iOS version of the 
app, I wrap this in a WKWebView, and put a lot of native UI in the rest of the 
app.

One of the things I want to be able to do is transition the player view from 
full-screen to something smaller (to hide and show details and related content, 
much like the YouTube player does).

The problem is that while the HTML/CSS-based overlay controls smoothly 
transition with the animated WKWebView frame transition, the WebGL field of 
view does not. It jumps to its new size at the start of the animation, then the 
rendered rectangle slides into the new position with the rest of the animation. 
It doesn't look good at all.

I'm not sure if there's a way to handle this. Ideally, the FoV and rendered 
frame would transition smoothly as well. Is there a way for web content to hook 
into the Core Animation that's happening. Perhaps I can execute a Javascript 
call in the WebGL code to animate the transition itself, but I'm worried that 
the abrupt frame change will affect us anyway.

Thanks for any ideas!

-- 
Rick Mann
rm...@latencyzero.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: Emailing from a daemon process

2016-07-07 Thread Aandi Inston
> > Is there a way to fire off a simple email from an ObjC Foundation-only
app running in the background

"Just" sending email seems like such a simple thing. But remember, a Mac
doesn't come out of the box able to send mail. It only gets that ability if
it is set up to do so (during initialisation, or later in a mail app). This
setup will include an SMTP server, and may well include personal login
information to that server. Macs do not (unless I missed it: would be
useful) set up a generic configuration that can be used to send mail.

So, if it is set up you would have to either interface with the email app
(if you know what it is), or read and use the preferences of the app (if
they are usable, and you'd rather hope security info wasn't).

Bear in mind too, that the user may not set up any email app, so there is
nothing to build on at all. I don't have any need to send email on most
Macs, so I don't set it up at all. On others, I use webmail like millions
of others; again, nothing to tap into, and the webmail service might not
even offer SMTP.

Now, if you are in a position to do so you can ask your user to set up
mail: you need an SMTP server, an optional port, and perhaps to support
security options securely (keychain?) Sending non-secure email to SMTP is
the absolutely trivial part (unless you want attachments). Bear in mind
many users will not have an SMTP server they can even give you and may be
stuck.

Lastly, sending SMTP traffic to port 25 is exactly the sort of thing that
malware does, so you are likely to hit blocks now or in the future.

Sorry if this is repeating points already made.
___

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: Emailing from a daemon process

2016-07-07 Thread Jonathan Mitchell

> On 7 Jul 2016, at 17:13, Carl Hoefs  wrote:
> 
> I have a daemon app built on Foundation (aka "command line tool") running in 
> the background and I need it to issue a textual email on certain conditions. 
> 
> The solutions for emailing that I've been able to find (NSWorkspace, 
> NSSharingService, LSOpenCFURLRef) all involve launching an email client like 
> Mail.app, which is inappropriate for a backgraound daemon process.
> 
> Is there a way to fire off a simple email from an ObjC Foundation-only app 
> running in the background on OS X 10.10.5 (not Server)? I'm told that ages 
> ago there was a handly class named NSMailDelivery, but it's long gone...


Not sure if this will pass muster. It seems reasonably alive in some forks.

https://github.com/MailCore/MailCore

It is a framework though.

J



___

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: Emailing from a daemon process

2016-07-07 Thread Gary L. Wade
Depending on your customers and product, sending these to your server and 
saving them there could be a support feature allowing you or the user to log in 
and review them when needed. Even if you don't, almost every web server is set 
up with sendmail such that you could utilize it instead.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

On Jul 7, 2016, at 11:01 AM, Carl Hoefs  wrote:

>> The manufacturers are probably running their own SMTP servers, and the 
>> devices either talk to those directly, or (more likely) send HTTP requests 
>> to the manufacturer’s web server, which then formats the email and sends it 
>> to the SMTP server.
> 
> Yes, this seems to be correct. I just checked such emails and I see the 
> manufacturers usually exploit gmail for this purpose (and I have no gmail 
> account).


___

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: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:55 AM, Jens Alfke  wrote:
> 
> 
>> On Jul 7, 2016, at 9:44 AM, Carl Hoefs > > wrote:
>> 
>> It seems a bit odd to me that I can connect all sorts of little network 
>> devices (webcams, network monitors, remote power switches, etc) to a LAN and 
>> they can all be set to issue email.
> 
> The manufacturers are probably running their own SMTP servers, and the 
> devices either talk to those directly, or (more likely) send HTTP requests to 
> the manufacturer’s web server, which then formats the email and sends it to 
> the SMTP server.

Yes, this seems to be correct. I just checked such emails and I see the 
manufacturers usually exploit gmail for this purpose (and I have no gmail 
account).

Received: from localhost ([72.87.216.146]) by smtp.gmail.com 


-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: Emailing from a daemon process

2016-07-07 Thread Doug Hill
Another thing to bring up is that users may not want an open Sendmail server 
running on their machine just so a background process can send email without 
the user's intervention. Huh, this is almost like what malware does.

Doug Hill

> On Jul 7, 2016, at 10:46 AM, Jens Alfke  wrote:
> 
> 
>> On Jul 7, 2016, at 10:01 AM, Carl Hoefs  
>> wrote:
>> 
>> I seem to recall that in the distant past I accomplished issuing emails from 
>> a daemon process on Linux by directly interfacing to /usr/sbin/sendmail. Is 
>> this the 'Postfix mail tools' you mentioned?
> 
> Yes, and sendmail on macOS is just a front-end to the Postfix system. The 
> trouble is that Postfix isn’t actually configured, so it looks like all 
> sendmail will do is write the email to a mail queue that’s not being 
> processed by anything. (You can read the main page for sendmail for details.)
> 
> You can set up Postfix without much trouble, but I assume you want your 
> daemon to work on anyone’s machine without them having to spend 5 minutes 
> mucking about with command-line tools first...
> 
> —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/cocoadev%40breaqz.com
> 
> This email sent to cocoa...@breaqz.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: Emailing from a daemon process

2016-07-07 Thread Jens Alfke

> On Jul 7, 2016, at 10:01 AM, Carl Hoefs  
> wrote:
> 
> I seem to recall that in the distant past I accomplished issuing emails from 
> a daemon process on Linux by directly interfacing to /usr/sbin/sendmail. Is 
> this the 'Postfix mail tools' you mentioned?

Yes, and sendmail on macOS is just a front-end to the Postfix system. The 
trouble is that Postfix isn’t actually configured, so it looks like all 
sendmail will do is write the email to a mail queue that’s not being processed 
by anything. (You can read the main page for sendmail for details.)

You can set up Postfix without much trouble, but I assume you want your daemon 
to work on anyone’s machine without them having to spend 5 minutes mucking 
about with command-line tools first...

—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: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:55 AM, Jens Alfke  wrote:
> 
> 
>> On Jul 7, 2016, at 9:44 AM, Carl Hoefs > > wrote:
>> 
>> It seems a bit odd to me that I can connect all sorts of little network 
>> devices (webcams, network monitors, remote power switches, etc) to a LAN and 
>> they can all be set to issue email.
> 
> The manufacturers are probably running their own SMTP servers, and the 
> devices either talk to those directly, or (more likely) send HTTP requests to 
> the manufacturer’s web server, which then formats the email and sends it to 
> the SMTP server.

I seem to recall that in the distant past I accomplished issuing emails from a 
daemon process on Linux by directly interfacing to /usr/sbin/sendmail. Is this 
the 'Postfix mail tools' you mentioned?

-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: Emailing from a daemon process

2016-07-07 Thread Jens Alfke

> On Jul 7, 2016, at 9:44 AM, Carl Hoefs  wrote:
> 
> It seems a bit odd to me that I can connect all sorts of little network 
> devices (webcams, network monitors, remote power switches, etc) to a LAN and 
> they can all be set to issue email.

The manufacturers are probably running their own SMTP servers, and the devices 
either talk to those directly, or (more likely) send HTTP requests to the 
manufacturer’s web server, which then formats the email and sends it to the 
SMTP server.

—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: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:33 AM, Jens Alfke  wrote:
> 
>> On Jul 7, 2016, at 9:13 AM, Carl Hoefs > > wrote:
>> 
>> I have a daemon app built on Foundation (aka "command line tool") running in 
>> the background and I need it to issue a textual email on certain conditions. 
> 
> Do you mean daemon or agent? A daemon runs outside of any user login session 
> and is usually started at boot time. An agent has no UI but is part of the 
> login session. This is significant, because an agent process can communicate 
> with GUI apps using AppleEvents or XPC.

It's a daemon, started at boot time and runs outside of a user login. Even so, 
it wouldn't be appropriate to communicate with a GUI app, which still requires 
user intervention, if only to press the Send button.

> 
> There isn’t any easy way of doing this that I know of, if you can’t tell 
> Mail.app to do it. There are built-in Postfix mail tools, but they’re not 
> configured for relaying mail to a server. You’d have to talk to the SMTP 
> server yourself, but that involves reading the user prefs to get the server 
> configuration, and likely finding credentials to log in with… (There might be 
> a 3rd party library for doing this, though.)

It seems a bit odd to me that I can connect all sorts of little network devices 
(webcams, network monitors, remote power switches, etc) to a LAN and they can 
all be set to issue email. I didn't really want to go 3rd party, as there is a 
yearly cost to the only package I could find (which is just a dylib, not 
source).

-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

NSTextView pagination

2016-07-07 Thread Jonathan Mitchell
Is there a recommended way to change the content of an NSTextView subclass 
during an NSPrintOperation preview?
My subclass needs to adjust its content depending on the NSPrintInfo page 
orientation.
Drawing into the margin with NSView -drawPageBorderWithSize: is not an 
appropriate solution in this case.

I have tried manipulating the views attributed string content in
- (BOOL)knowsPageRange:(NSRangePointer)range
but this logs CG warnings and can behave unpredictably - presumably because the 
content is getting manipulated at an inappropriate point.
It also doesn’t produce the correct paginated output.

Any ideas?

I could supply a new view that would correspond to the new page orientation (if 
I could get an appropriate   notification) but NSPrintOperation’s -view is 
readonly.

Thanks

Jonathan



___

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: Emailing from a daemon process

2016-07-07 Thread Jens Alfke

> On Jul 7, 2016, at 9:13 AM, Carl Hoefs  wrote:
> 
> I have a daemon app built on Foundation (aka "command line tool") running in 
> the background and I need it to issue a textual email on certain conditions. 

Do you mean daemon or agent? A daemon runs outside of any user login session 
and is usually started at boot time. An agent has no UI but is part of the 
login session. This is significant, because an agent process can communicate 
with GUI apps using AppleEvents or XPC.

There isn’t any easy way of doing this that I know of, if you can’t tell 
Mail.app to do it. There are built-in Postfix mail tools, but they’re not 
configured for relaying mail to a server. You’d have to talk to the SMTP server 
yourself, but that involves reading the user prefs to get the server 
configuration, and likely finding credentials to log in with… (There might be a 
3rd party library for doing this, though.)

—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

Emailing from a daemon process

2016-07-07 Thread Carl Hoefs
I have a daemon app built on Foundation (aka "command line tool") running in 
the background and I need it to issue a textual email on certain conditions. 

The solutions for emailing that I've been able to find (NSWorkspace, 
NSSharingService, LSOpenCFURLRef) all involve launching an email client like 
Mail.app, which is inappropriate for a backgraound daemon process.

Is there a way to fire off a simple email from an ObjC Foundation-only app 
running in the background on OS X 10.10.5 (not Server)? I'm told that ages ago 
there was a handly class named NSMailDelivery, but it's long gone...

-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: UIStackView: Variable Spacing

2016-07-07 Thread Fritz Anderson
Confirming that your concern is now Auto Layout overhead?

---

Long, long ago, when there were no iPads or Auto Layout (2009?), the 
scrolling-performance session at WWDC said if your cells had nontrivial subview 
trees, and the table was stuttering, bite the bullet and start aggregating 
subview nodes into monoliths that you lay out and draw yourself.

iOS devices are an order of magnitude faster now, but that doesn’t solve the 
problem in principle, just puts it off.

---

Obviously it’s a lot of work to code (and maybe to execute — you’ll have to use 
trial-and-error to find an ad-hoc solution); ad-hoc makes refactoring harder; 
you’ll be spending your vacations in Caching Inferno; etc. You’d sacrifice Make 
it Right for Make it Fast. That’s supposed to be a smell, but in this case Make 
it Fast _is_ Make it Work.

I don’t know nearly enough about your application to say whether it’s an 
option. I’ve had reasonable success with splitting the difference and replacing 
leaf views with layers to relieve the combinatorial explosion AL risks.

---

If Auto Layout has no combinatorial risks, or surprisingly few, I’d be 
fascinated to know why.

— F

> On 6 Jul 2016, at 6:56 PM, Daniel Stenmark  wrote:
> 
> It’s not so much that adding a single dummy view wrecks us.  Our cell layout 
> has a lot going on, with a fair amount of variable spacing and multiple views 
> often being hidden and swapped out.  The UIStackView scrolling performance 
> slog I’m seeing is just sum of all that.
> 
> Sigh, oh well.  I guess that’s just another refactoring branch I’ll have to 
> shelve for now.
> 
> Dan
> 
>> On Jul 6, 2016, at 4:45 PM, Roland King  wrote:
>> 
>> 
>>> On 7 Jul 2016, at 04:37, Daniel Stenmark  wrote:
>>> 
>>> What’s the best way to achieve variable spacing between children of a 
>>> UIStackView?  I know that a popular approach is to add an empty dummy view 
>>> to act as padding, but this is being used in a UITableView cell, so 
>>> scrolling performance is critical and the implicit constraints created by 
>>> adding a ‘padding’ view are a death knell for us.  
>>> 
>>> Dan
>> 
>> 
>> There’s no trick way to do it, you need some extra view one way or another. 
>> 
>> It’s a bit surprising that adding extra, fixed sized children to the stack 
>> really adds that much overhead, that’s a few very simple constraints, all 
>> constant, and shouldn’t really make that much difference. Perhaps the 
>> stackview is being inefficient with the number of constraints it adds when 
>> you add an extra child. You could take a look at the view hierarchy and see 
>> if that’s the case or not. 
>> 
>> You could try going the other way around and making your real elements 
>> children of dummy views so you get to add the simplest top/bottom-padding 
>> constraints possible to those views, that may minimise the number of extra 
>> constraints added and you get to control it somewhat. But if your hierarchy 
>> is such that it’s straining the constraint system performance wise, whatever 
>> way you try to do this is going to have similar performance.
> 
> 
> ___
> 
> 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/fritza%40manoverboard.org
> 
> This email sent to fri...@manoverboard.org


___

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

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

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

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