How to make an app launch on login?

2016-04-19 Thread Jens Alfke
One of my companies’ apps has a “Launch at login” pref, which no longer works in OS X 10.11. I’m not surprised, since the existing code implements this by writing into loginwindow’s user defaults :-p I’m trying to find the currently supported API for this. The “Adding Login Items” page says: >

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:35 PM, Jeff Szuhay wrote: > > I spoke too soon; yes, all of this is marked as “available but deprecated on > 10.11”. Yeah, interesting that Apple added LSSharedFileListItemCopyResolveURL in 10.10 and then deprecated it in 10.11. Oops! I guess I’ll use this API anyway

Re: How to make an app launch on login?

2016-04-19 Thread Jens Alfke
> On Apr 19, 2016, at 2:43 PM, Jeff Szuhay wrote: > > The preferred way seems to be through the use of launchd I don’t think so. I’ve worked with launchd before — it provides very low-level functionality for starting background processes, and there’s no visible UI for configuring it. Not at a

Re: Proper way to set up constants when building an iOS framework

2016-04-20 Thread Jens Alfke
> On Apr 20, 2016, at 11:11 AM, Alex Zavatone wrote: > > I wasn't thinking that I'd make yet another header, (the .pch) to then > include the constants header and then it would need to be at the same level > in the framework as the constants file or would need to be able to see the > path to

Re: How to make an app launch on login?

2016-04-20 Thread Jens Alfke
FYI, I just filed a bug report complaining about the lack of a reasonable native API for this. rdar://25834170 . —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: Correct way to specify anchors with NSURL?

2016-04-21 Thread Jens Alfke
> On Apr 20, 2016, at 10:16 PM, Graham Cox wrote: > > Annoying that the ‘fragment’ property of NSURL is read-only, that looks like > an obvious way to do it, if the API was sane. The API is sane. NSURLs are immutable, just like NSStrings and many other Foundation classes. NSURLComponents ba

Re: Using a Core Data model by itself

2016-04-28 Thread Jens Alfke
> On Apr 28, 2016, at 10:56 AM, Daryle Walker wrote: > > Can I use a CD model object without managed contexts nor persistent stores? I’m pretty sure you can’t, but if you’re not doing anything fancy in your modeling, the classes will just be pretty vanilla classes with some properties. So you

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 1, 2016, at 9:06 AM, thatsanicehatyouh...@me.com wrote: > > As I've been thinking about this problem it occurred to me that the new(ish) > NSCollectionView might be a viable replacement in this case. Before I go down > the rabbit hole, is it reasonable to use to create a spreadsheet-li

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 3, 2016, at 12:08 PM, thatsanicehatyouh...@me.com wrote: > > I should have been more specific - my understanding was that NSCollectionView > from 10.11 onward did not do this... which Alex Kac just beat me to > mentioning! I was curious if anyone was aware of limitations of this scope

Re: Yosemite NSCollectionView appropriate for spreadsheet-like view?

2016-05-03 Thread Jens Alfke
> On May 3, 2016, at 12:33 PM, Alex Kac wrote: > > There is the old NSCollectionView and the new. You have to use the new > delegate methods and so on. Its the same class, but behind the scenes the new > collection view is literally the UICollectionView from iOS ported over > (syslog even say

Re: Where are my bytes hiding?

2016-05-05 Thread Jens Alfke
> On May 5, 2016, at 4:38 AM, Gerriet M. Denkmann wrote: > > The sum of all decmpfs in the folder is 4057 bytes - still no idea how Finder > gets its: “29 KB on disk” . Any file, even if empty, occupies at least one 4k disk sector. In this case I would guess there are 7 files in that director

Re: Where are my bytes hiding?

2016-05-05 Thread Jens Alfke
> On May 5, 2016, at 12:01 PM, Martin Wierschin wrote: > > Is there any way a user file might be compressed in such a way through normal > user actions? Yes, there are various user-level utilities for compressing files, like Clusters (http://clustersapp.com ). The `di

Re: NSTableView is messaging zombie delegate

2016-05-06 Thread Jens Alfke
> On May 6, 2016, at 1:03 PM, Matthew LeRoy wrote: > > My understanding is that NSTableView's delegate is a zeroing weak reference Are you sure? Historically it’s been unsafe_unretained — in the old days before weak references or ARC, the view never retained nor released the delegate. The typ

Re: Receiver type for instance message is a forward declaration

2016-05-06 Thread Jens Alfke
> On May 6, 2016, at 1:42 PM, Carl Hoefs wrote: > > I would have thought that this earlier line would have been flagged if > RAOperation.h hadn't been included: > > RAOperation *op = [self _popOperation: listPtr]; There must be a forward declaration (“@class RAOperation”) somewhere abov

Re: NSTableView is messaging zombie delegate

2016-05-08 Thread Jens Alfke
> On May 8, 2016, at 12:19 PM, Matthew LeRoy wrote: > > Unfortunately, setting the table view’s delegate to nil during tear-down > (either in -windowWillClose: or in NSViewController’s -dealloc) doesn’t seem > to fix the issue. I still get random but regularly reproducible crashes, with > the

Re: discontiguous bounds ?

2016-05-09 Thread Jens Alfke
> On May 8, 2016, at 10:32 PM, Miller Dale wrote: > > I wish to provide a facility with a NSTableView wherein the leftmost > (specifiable) columns remain statically on the left of the display (subject > to vertical scrolling) while the remaining columns scroll normally > constrained to the ri

Re: XCode snapshot function?

2016-05-09 Thread Jens Alfke
> On May 9, 2016, at 6:48 PM, Graham Cox wrote: > > So what’s the best way to mothball and archive my project in its current > state so I can then fork it for the next version, and so on? Git. The Snapshot feature was basically made redundant once Xcode added support for Git, so it makes sen

Re: Protecting against "app nap"

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 10:26 AM, Jonathan Taylor > wrote: > > However, I was a bit surprised to find that I seem to need to explicitly > retain the object I get back [this is non-ARC code…] if I want my request to > remain in effect or even for the object to remain allocated to allow me to >

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 1:38 PM, Carl Hoefs > wrote: > > )}: An -observeValueForKeyPath:ofObject:change:context: message was received > but not handled. > Key path: operations > Observed object: {name = 'Upload Queue'} An object got a KVO notification but doesn’t have a observer method to handl

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Jens Alfke
> On May 10, 2016, at 4:05 PM, Carl Hoefs > wrote: > > Yes, yes, and yes! I'm using a nil context. I'm not sure how context is to be > used here... Is this an arbitrary value that I check in > -observeValueForKeyPath? Yes, but I’m not aware of it being required … what goes wrong if it’s NULL

Re: objc [66375] class Foo is implemented in both BundleA and BundleB

2016-05-11 Thread Jens Alfke
> On May 10, 2016, at 11:05 PM, Jeff Szuhay wrote: > > Class Foo is a base class. It is subclassed in BundleA, BundleB, … BundleZ. Where is Foo itself implemented? If there are copies of the Foo class in each bundle then yeah, you’ll get that warning. > Is there a better way to do it? I can’

Re: Protecting against "app nap"

2016-05-11 Thread Jens Alfke
> On May 11, 2016, at 2:31 AM, Jonathan Taylor > wrote: > > I guess I just found method naming a bit odd (not really referring to an > object at all), and might have expected it to have an ‘alloc/new’ naming > since I’d have thought the API would be almost exclusively used for > activities t

Re: ARC [was Protecting against "app nap"]

2016-05-12 Thread Jens Alfke
> On May 12, 2016, at 1:16 AM, Jonathan Taylor > wrote: > > you would definitely recommend ARC then, would you? Totally. As Roland said, I would never go back. > I've been a bit put off by what seems like regular questions on the list(s) > about debugging and fixing edge cases where ARC does

Re: objc [66375] class Foo is implemented in both BundleA and BundleB

2016-05-13 Thread Jens Alfke
> On May 13, 2016, at 1:23 AM, Jeff Szuhay wrote: > > 1) Project headers are only available within the framework and not to any > other “consumer” of the framework. >Which is to say, my bundles, which “consume" the framework, cannot see > project headers. Right. “Project” is just the defa

Re: Recurrent background thread

2016-05-13 Thread Jens Alfke
> On May 13, 2016, at 12:34 PM, Carl Hoefs > wrote: > > As a test, the above works if run on the main thread, so I'm guessing it has > something to do with there being no runloop after the background thread > exits. Yup. More precisely, the background thread has no runloop at all. Its top-l

Re: Decide which mail app to use for mailto: links

2016-05-18 Thread Jens Alfke
> On May 18, 2016, at 10:04 AM, Paul Brown wrote: > > Is it possible to have the user select their preferred mail application that > will respond to this? The Launch Services framework has C functions that allow you to (a) find applications that register a handler for a URL scheme, and (b) se

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 7:51 AM, Alex Zavatone wrote: > > Is there a means to have an object know when it's being observed so that it > will refuse to nuke itself in this condition? Nope. Remember, objects don’t “nuke” themselves; they are dealloced when no other objects have references to them

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 9:54 AM, Alex Zavatone wrote: > > OK, fair enough. Looks like I'll have build a little weak referenced dealy > that subclasses dealloc and stops if it detects any observers. Holy crap, don’t do that. First, you can’t stop a dealloc. Instead you’d have to override retai

Re: iOS - the joy of observers and NSInternalInconsistancyException for KVO

2016-05-19 Thread Jens Alfke
> On May 19, 2016, at 1:24 PM, Alex Zavatone wrote: > > In this case, I'm trying to see what is causing this deallocation. In my > code, I explicitly remove the observer before I nil the object, so I don't > know where this is happening. If you’re observing an object, you should probably e

Re: Need advice on a custom run-loop mode

2016-05-20 Thread Jens Alfke
> On May 20, 2016, at 12:58 AM, Graham Cox wrote: > > First question: does that even sound like a proper use for a custom run-loop > mode? Yes. > If the answer is yes, how do I cause the run loop to run in that mode? Do I > have to run the loop mysef until the operation is done? Yes, use a

Re: Need advice on a custom run-loop mode

2016-05-21 Thread Jens Alfke
> On May 20, 2016, at 11:55 PM, Graham Cox wrote: > > The view is definitely being marked dirty, and I’m explicitly calling > -displayIfNeeded, and -drawRect: is getting called as a result. But the > screen is not updated. I tried making an explicit call to flush the graphics > context but th

Re: NSAlert and threading

2016-05-23 Thread Jens Alfke
> On May 23, 2016, at 2:41 PM, Fritz Anderson wrote: > > Hence the rule that you don’t do _anything_ lengthy on the main (GUI-runloop) > thread. You can see how using a separate thread would solve your problem. > Welcome to 2003. Less dogmatically, you can use -performSelector:withObject:aft

Re: debugging AirDrop (update)

2016-05-27 Thread Jens Alfke
File a bug report with Apple! —Jens (who has intermittent troubles with AirDrop too) > On May 27, 2016, at 10:47 AM, Gerriet M. Denkmann > wrote: > > >> On 27 May 2016, at 23:18, Steve Christensen wrote: >> >> I haven't worked with AirDrop, but I just looked at the docs and one of the >> d

Re: Simplest way to generate audio tones?

2016-05-29 Thread Jens Alfke
> On May 28, 2016, at 8:24 PM, Graham Cox wrote: > > I’m looking for general pointers to the simplest/quickest way to generate an > audio tone (sine wave) of a given frequency and duration. Most of the audio > APIs seem concerned with playing samples rather than generating tones, so > it’s no

Re: NSFileWrapper

2016-06-04 Thread Jens Alfke
> On Jun 4, 2016, at 9:18 AM, Peter Hudson wrote: > > You're right - I want the behaviour of a package. Do you happen to know how I > can achieve it? I had presumed it might be some mix of flag setting at > system level. If for example i set the extension on an NSFileWrapper to > .bundle

Re: NSFileWrapper

2016-06-04 Thread Jens Alfke
> On Jun 4, 2016, at 9:51 AM, Peter Hudson wrote: > > “If your app’s performance is suffering because of large files, then use > streams instead, and try to only read the part of the file that’s necessary.” > Could you point me at some material about this technique ? It sounds very > interest

Re: NSFileWrapper

2016-06-05 Thread Jens Alfke
> On Jun 4, 2016, at 11:52 PM, Charles Srstka wrote: > > Every time I’ve ever tried to use NSFileWrapper, I’ve always ended up having > to switch to something else because of the memory issue that Jens mentions. > Never really understood the point of that class. I was going to say that "AFAIK

Re: quicklook audio sample rates

2016-06-10 Thread Jens Alfke
> On Jun 9, 2016, at 6:03 PM, George Toledo wrote: > > Does Quicklook play audio of a previewed file at the sample rate it was > encoded at, or is it somehow doing a samplerate conversion on the fly? QuickLook is just calling AVFoundation, which is calling CoreAudio. CoreAudio [obviously] trie

Re: quicklook audio sample rates

2016-06-10 Thread Jens Alfke
> On Jun 10, 2016, at 10:37 AM, じょいすじょん > wrote: > > I assumed the OP is interested to know whether listening to the playback in > QuickLook is going to be a valid exercise > for a pro audio person, versus opening the file in any particular application. If the sample rates didn’t match, and C

Re: Tick marks on scroll bars

2016-06-13 Thread Jens Alfke
I've done it by subclassing NSScroller. (The code's not open-source, though.) As far as I know, that's the only way to do it. It's fairly easy. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: Tick marks on scroll bars

2016-06-13 Thread Jens Alfke
> On Jun 13, 2016, at 9:18 AM, じょいすじょん > wrote: > > Did you do run into any issues with rubberbanding and responsive/momentum > scrolling? Why would I? I just overrode the method that draws the background. —Jens ___ Cocoa-dev mailing list (Cocoa-d

Re: KERN_INVALID_ADDRESS

2016-06-13 Thread Jens Alfke
___ 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.co

Re: Properties: A question of style

2016-06-15 Thread Jens Alfke
> On Jun 14, 2016, at 4:48 PM, Graham Cox wrote: > > @property (readonly) BOOL isFoo; > > or: > > @property (readonly, getter=isFoo) BOOL foo; Are you asking whether it’s better to name a boolean property “foo” or “isFoo”? Or are you asking about the naming of the getter method for a no

Re: Storing cache data in NSDocument

2016-06-16 Thread Jens Alfke
> On Jun 16, 2016, at 3:46 PM, Rick Mann wrote: > > My complex app generates a lot of intermediary data that's cached to speed up > operations. Would it be reasonable to store this inside the document package? > The idea being that that way, the entire set of data can be moved around > easily

Re: Storing cache data in NSDocument

2016-06-16 Thread Jens Alfke
> On Jun 16, 2016, at 4:58 PM, Rick Mann wrote: > > Yeah, that's what I'm currently doing. I guess the frequency with which files > are transferred is very low. Regenerating some of the data can take many > hours, though… Maybe you could add an Export command that copies the document with the

Re: Security with Streams

2016-06-25 Thread Jens Alfke
> On Jun 18, 2016, at 2:34 AM, Gerriet M. Denkmann wrote: > > 1. (important) the client really wants to know that: > (1a) it is talking to the right server and not to some evil entity > masquerading as the real server. > (1b) the data it receives has not been tampered with on the wa

Re: Security with Streams

2016-06-26 Thread Jens Alfke
> On Jun 25, 2016, at 7:44 PM, Gerriet M. Denkmann wrote: > > Following TN2326 I created a (self signed) Certificate Authority and a > Digital Identity called "MyServerId". You probably used the Keychain Access app for this? That works fine, but you’ll probably want every instance of the serv

Re: Security with Streams

2016-06-26 Thread Jens Alfke
> On Jun 26, 2016, at 8:13 PM, Gerriet M. Denkmann wrote: > > Assume that an evil entity has got hold of “MyServerCertificate.cer”, but has > no access to my keychain and thus to the private key of MyServerCertificate. > Could they use this certificate to open a secure stream to a client? Or d

Re: Security with Streams

2016-06-27 Thread Jens Alfke
> On Jun 26, 2016, at 11:30 PM, Gerriet M. Denkmann > wrote: > > Could it, instead of getting the SecIdentityRef from the keychain, just use > MyServerCertificate.cer instead? Nope. The server has to have a SecIdentityRef, because its side of the SSL handshake requires using the private key

Re: Nullability question (NSEvent)

2016-06-27 Thread Jens Alfke
> On Jun 27, 2016, at 10:03 AM, Stefan Haller wrote: > > I see that -[NSEvent characters] is marked nullable; however, the > documentation seems to say otherwise. Have you checked the 10.12 SDK? From the API diffs I’ve seen, Apple's been correcting nullability annotations where they conflict

Re: How can I get a single threaded network call in ObjC on iOS?

2016-06-28 Thread Jens Alfke
> On Jun 28, 2016, at 12:52 PM, Jim Adams wrote: > > I have an application that has the requirement that the accesses to the > server be single threaded, i.e. the second request cannot go through until > the first request has completed. That’s pretty unusual. I take it this is a restriction o

Re: Issue with read/write to NSFileHandle

2016-06-30 Thread Jens Alfke
> On Jun 29, 2016, at 8:40 PM, Graham Cox > wrote: > > Reading the documentation, NSFileHandle seems to have only one file offset, > which is common to both read and write, which is a bit puzzling, because > surely you’d want to write at the end of the file, but

Re: Prioritize my own app's disk access

2016-07-05 Thread Jens Alfke
You might try asking on the darwin-userlevel mailing list. In addition to increasing I/O priority, there may be other ways to make your disk writes more efficient. For example you can preallocate space for the file before writing to it. Writing in larger chunks may also help. (Of course you may

Re: Property synthesis trouble - 32 vs 64 bit builds

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 4:36 AM, Jonathan Taylor > wrote: > > It surprises me that I have to write different synthesis code for 32- or > 64-bit builds It’s because they use different Obj-C runtimes. For compatibility reasons, 32-bit Mac apps still use the old runtime, while 64-bit apps (and all

Re: Property synthesis trouble - 32 vs 64 bit builds

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 2:10 PM, Jonathan Taylor > wrote: > > Quicktime. Oh, you poor thing. That’s one nasty API. (Actually dozens of nasty APIs.) O_o > My code has been 32-bit only since I first wrote it, because I make use of > the APIs in QuickTime/ImageCompression.h for encoding movies. It

Re: Prioritize my own app's disk access

2016-07-05 Thread Jens Alfke
> On Jul 5, 2016, at 2:40 PM, Jonathan Taylor > wrote: > > As far as the quality of service goes, I can't see the APIs for that (looking > in the 10.9 SDK, at least). Am I looking in the wrong place? IIRC, QoS was added in 10.10. > I confess that currently I am using pure cocoa -writeToFile:

Re: Prioritize my own app's disk access

2016-07-06 Thread Jens Alfke
> On Jul 6, 2016, at 3:06 AM, Jonathan Taylor > wrote: > > I should also clarify that (in spite of my other email thread running in > parallel to this) I am not doing any complex encoding of the data being > streamed to disk - these are just basic TIFF images and metadata. Since you said pre

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

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 SMT

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

Re: Encoding of Swift string literals?

2016-07-07 Thread Jens Alfke
> On Jul 7, 2016, at 6:16 PM, William Squires wrote: > > 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). I think you’re asking about what string

Re: Emailing from a daemon process

2016-07-08 Thread Jens Alfke
> On Jul 8, 2016, at 8:13 AM, Sal Conigliaro wrote: > > You can send mail using sendmail without having to configure Postfix or > Sendmail. > Out of the box OS X can use sendmail to send messages. I didn’t think this would actually work, but I tried it and it does. It relayed to the SMTP server

Re: Emailing from a daemon process

2016-07-08 Thread Jens Alfke
> On Jul 8, 2016, at 8:44 AM, Alastair Houghton > wrote: > > It has a very high probability of being marked as spam, whatever headers you > use, because it’ll be delivered direct to the recipient’s mail server Oh — I hadn’t thought of that. I sent my test email to myself, so of course it con

Re: WKWebView and Mobile Safari and cookie sharing

2016-07-09 Thread Jens Alfke
> On Jul 9, 2016, at 10:29 AM, Torsten Curdt wrote: > > Hm - noone? > Any idea where else to ask or read up on? The webkitsdk-dev list (on this same server.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin re

Re: Root URL and URLByDeletingLastPathComponent

2016-07-17 Thread Jens Alfke
> On Jul 17, 2016, at 6:49 AM, thatsanicehatyouh...@me.com wrote: > >> It might be a mishandling of the two sorts of rot URL. If you try feeding in >> this URL manually: >> >> file://localhost/ >> >> and removing the last component, what do you end up with? > > That just treats it as a file

Re: Vertical orientation of UISlider

2016-07-20 Thread Jens Alfke
> On Jul 20, 2016, at 12:02 PM, Carl Hoefs > wrote: > > I was looking for the obvious, a simple property like slider.orientation or > some such. In AppKit, an NSSlider’s orientation is determined simply by whether its bounds rectangle is longer than it’s wide, or vice versa. Is the same true

Re: Ending NSTask doesn't release file handle opened by the task it wraps.

2016-07-21 Thread Jens Alfke
That’s strange. I would use the `lsof` tool to figure out which process has that file open. You can also use `fs_usage` while the tool is running to monitor all the filesystem activity on that file. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.ap

Re: kCFStreamPropertySSLSettings

2016-07-22 Thread Jens Alfke
> On Jul 22, 2016, at 2:46 AM, Gerriet M. Denkmann wrote: > > When it gets some streams it will show a panel: > “MyApp wants to sign using key “something” in your keychain” / “Allow” “Deny” Presumably this app is either acting as an SSL server, or is sending SSL clients. Either of those roles

Re: kCFStreamPropertySSLSettingC

2016-07-25 Thread Jens Alfke
> On Jul 25, 2016, at 6:47 AM, Gerriet M. Denkmann wrote: > > What would be the right thing to choose? “Mac Developer” while you’re developing, I.e. for your regular build-and-run cycle. “Mac Distribution” is for Release builds you’re going to submit to the Mac App Store. “Developer ID” is fo

Re: NSFileHandle and thread safety

2016-07-25 Thread Jens Alfke
> On Jul 25, 2016, at 12:37 PM, Daniel Stenmark wrote: > > 2. Can I read from a single file using two NSFileHandles on two threads at > the same time? > > Why would you need to do that in the first place? To get multithreaded access to the file contents. This is pretty common when using da

Re: Emailing from a daemon process

2016-08-03 Thread Jens Alfke
> On Jul 7, 2016, at 6:56 PM, Bruce Stephens wrote: > > Could use a simple Perl script… quick easy and nasty… We already spent many messages dissecting why simply invoking sendmail doesn’t work. > Works!!! It might work on your machine, because you’ve configured Postfix to route mail proper

Re: NSImage drawInRect deadlock

2016-08-08 Thread Jens Alfke
> On Aug 8, 2016, at 12:46 PM, Aaron Tuller wrote: > > Search for NSImage here: > > https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/1057i-CH12-126728 > >

Re: NSImage drawInRect deadlock

2016-08-08 Thread Jens Alfke
> On Aug 8, 2016, at 2:54 PM, Aaron Tuller wrote: > > "The following classes and functions are generally not thread-safe. In most > cases, you can use these classes from any thread as long as you use them from > only one thread at a time." The images are only being used on one thread at a tim

Re: NSImage drawInRect deadlock

2016-08-09 Thread Jens Alfke
>> I was under the impression from the docs that macOS >> handles the thread pool “automatically”. GCD’s pool does use a thread per CPU core … but only as long as none of the operations run for a long time. If its entire thread pool is busy for “a while” and there are more blocks waiting in the

Re: Cocoa File Close Notification

2016-08-10 Thread Jens Alfke
> On Aug 10, 2016, at 12:10 PM, Gurkan Erdogdu wrote: > > I try to get file close notification in Cocoa/Swift. Is there any way to do > this? I tried to use FSEvent API but this does not provide any notification > for file close events. I don’t think there’s any such notification. File handle

Re: Xcode 8 - XCODE_VERSION_MAJOR causes compilation issue

2016-08-12 Thread Jens Alfke
> On Aug 11, 2016, at 12:09 AM, Sasikumar JP wrote: > > Xcode defines following build variables, we can not use them in Xcode 8 > as the values are invalid octal number. Who says they’re supposed to be octal? The reason for the leading zero is presumably just so they’ll still sort correctly

Re: NSTask Open Word File

2016-08-12 Thread Jens Alfke
> On Aug 11, 2016, at 6:20 PM, Gurkan Erdogdu wrote: > > Hi folks > In my Swift application, I try to open a Word file with Microsoft Word > application via NSTask. To add to what Charles said: NSTask is only for running command-line tools or other non-GUI binaries. Don’t use it to run a GUI

Re: Class is implemented in both

2016-08-15 Thread Jens Alfke
> On Aug 15, 2016, at 3:41 AM, Stephane Sudre wrote: > > . you could redefine the class name in the .pch of one project. +1 — I’ve had to do this before, and it works fine. Just add #define MyDisplayManager MyDisplayManager_PP or whatever. The caveat is that of course IB doesn’t read t

Re: Class is implemented in both

2016-08-15 Thread Jens Alfke
> On Aug 15, 2016, at 11:34 AM, Jean-Daniel Dupas wrote: > > No, You can have only one PCH per project. That said, you can define a second > one that include the first one for your second project. I think you meant to say you can have only one PCH per _target_. —Jens _

Re: Launch, connect, communicate

2016-08-19 Thread Jens Alfke
> On Aug 15, 2016, at 7:26 PM, Andrew Keller wrote: > > 1. If the main Plot app is _not_ running in the current Aqua session, then > launch a new copy in the current Aqua session. > 2. Open some sort of a socket to the main Plot app in the current Aqua > session. > 3. Accept numbers on stdin,

Re: Does setFormatter() retain?

2016-08-24 Thread Jens Alfke
> On Aug 24, 2016, at 1:04 PM, Andreas Falkenhahn > wrote: > > Now, will "setFormatter" call retain on "formatter" or not? Looking > at "retainCount" seems to suggest so, although I know that this > isn't reliable and shouldn't be done at all... These days, with ARC, we call those “strong refe

Re: Mysterious crash with NSTableView

2016-08-26 Thread Jens Alfke
> On Aug 26, 2016, at 8:42 AM, Andreas Falkenhahn > wrote: > > But once again, I think it's a crime that there is no mentioning of this in > the class > documentation of "setDelegate" and "setDatasource" :( In the Xcode 8 docs for NSTableView.dataSource, it does: "Note that in versio

Re: Pixel-perfect migration from ATSUI to Core Text

2016-08-29 Thread Jens Alfke
> On Aug 29, 2016, at 8:46 AM, Ken Thomases wrote: > > First, this has nothing to do with Cocoa and so isn't appropriate for > Cocoa-Dev. There is a CoreText mailing list at lists.apple.com , I believe. —Jens ___ Cocoa-dev

Re: Swift changes in Xcode 8

2016-08-30 Thread Jens Alfke
> On Aug 30, 2016, at 4:41 PM, Rick Mann wrote: > > Here's the situation. I've got a Swift app that I've developed in Xcode > 7/Swift 2.2. Using the legacy compatibility mode, I can try build it in Xcode > 8, but unfortunately, a lot of the iOS API has changed (e.g. optionality has > changed)

Re: Get file argument

2016-09-04 Thread Jens Alfke
> On Sep 4, 2016, at 4:56 AM, Andreas Falkenhahn wrote: > > Is there also a way to get the file argument without having an NSApp, > i.e. can my program somehow obtain the file argument *before* creating > the NSApp object or is that impossible? Perhaps through LaunchServices, or by implementing

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-05 Thread Jens Alfke
> On Sep 5, 2016, at 6:51 AM, Motti Shneor wrote: > > 1. Why don’t Safari, Mail, Photos, and other standard apps trigger such > dialog when they clearly use proxy settings (including credentials) to go to > the internet? Is this behavior acceptable, and how is it done? Those apps are signed b

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-07 Thread Jens Alfke
> On Sep 6, 2016, at 5:36 AM, Motti Shneor wrote: > > All my app does, is use KeyChain APIs to read proxy user/password. I believe > securityd agent/daemon is the one to prompt user for permission. It runs > under user ‘root’ - much like my own daemon. Yes, but root isn’t a normal user accou

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-07 Thread Jens Alfke
> On Sep 6, 2016, at 5:36 AM, Motti Shneor > wrote: > > All my app does, is use KeyChain APIs to read proxy user/password. I believe > securityd agent/daemon is the one to prompt user for permission. It runs > under user ‘root’ - much like my own daemon. Yes, but

Re: What difference exist from where a method will be called?

2016-09-07 Thread Jens Alfke
> On Sep 7, 2016, at 1:18 PM, Raimond Hettrich wrote: > > Now when this method will be called by a button press the array will be > printed out correctly. ... > But if the method will be called from the drawRect method, the array will be > printed out without the contend. Then in the drawRec

Re: C callbacks with NSNotificationCenter?

2016-09-07 Thread Jens Alfke
> On Sep 7, 2016, at 10:03 AM, Alastair Houghton > wrote: > > All of it can. Objective-C is just C with some syntactic sugar on top. There’s a large amount of semantic sugar too, i.e. the runtime libraries. (If you think the runtime part must be trivial, go read some of Mike Ash’s posts a

Re: Can't convert to swift 3 and support

2016-09-09 Thread Jens Alfke
> On Sep 9, 2016, at 2:19 AM, Rick Mann wrote: > >'getResourceValue(_:forKey:)' is unavailable: Use >struct URLResourceValues and URL.setResourceValues(_:) >instead > > Problem is, that only exists on iOS 10. According to NSURL.h, the setResourceValues method has been available sin

Re: Why doesn't this crash?

2016-09-10 Thread Jens Alfke
> On Sep 10, 2016, at 5:16 AM, Pascal Bourguignon > wrote: > > It returns nil by feature of Objective-C. > Referencing the class will translate into a runtime class lookup which will > return nil. Sending a message to nil will return nil. Well, not exactly. If you reference the class name a

Re: Swift and Threads

2016-09-12 Thread Jens Alfke
> On Sep 12, 2016, at 6:42 AM, Gerriet M. Denkmann wrote: > > So: is the code ok and the compiler broken in Debug mode? > Or is the code fundamentally wrong and that it works in Release is just a > fluke? 99% of the time it’s the latter. Which means you should try to debug the code. Did you s

Re: Swift and Threads

2016-09-12 Thread Jens Alfke
> On Sep 12, 2016, at 9:34 AM, Jean-Daniel wrote: > > Array are value based in Swift and so use COW optimization, which mean that > even if you don’t resize them, you may hit a race condition issue. Yes, you’re right. The question in my mind is whether the array struct ever gets copied in thi

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Jens Alfke
> On Sep 12, 2016, at 10:14 AM, Quincey Morris > wrote: > > FWIW, it’s pretty clear that the version of Swift in the Xcode 8 GM is > generating incorrect code or incorrect debug information Well, that’s comforting to hear. O_o At least it doesn’t catch fire, does it? —Jens _

Re: Swift and Threads

2016-09-12 Thread Jens Alfke
> On Sep 12, 2016, at 11:11 AM, Quincey Morris > wrote: > > My understanding is that pure Swift arrays (that is, *not* bridged NSArrays) > are stored as efficiently as C arrays. It’s not the efficiency of storage I was concerned about; in this case it’s the COW semantics, which can involve t

Re: Swift and Threads

2016-09-12 Thread Jens Alfke
> On Sep 12, 2016, at 9:21 PM, Gerriet M. Denkmann wrote: > > READ of size 1776 at 0x61ce68a0 thread T0 >#0 0x1000516f3 in wrap_memcpy (libclang_rt.asan_osx_dynamic.dylib+0x406f3) >#1 0x100f85a88 in __swift_memcpy_array1_1 (libswiftCore.dylib+0x1dea88) >#2 0x100dd9a3e in _TZFSa11

Re: Passing param by reference then using within block throws exception

2016-09-20 Thread Jens Alfke
I think the real problem is that the -enumerateObjectsUsingBlock: method has an autorelease pool. If your real code is assigning something other than a string constant to *fillMeIn, that string will probably get dealloced when the autorelease pool drains. Your workaround is correct, since assign

Re: How to update UI from a background thread

2016-09-21 Thread Jens Alfke
> On Sep 21, 2016, at 8:40 AM, Dave wrote: > > How can I update my UI from a background thread? You can’t literally do that. But you can schedule code to run on the main thread, and update the UI in that code. Use dispatch_async to schedule the UI-related code on the main thread/queue. Or if

Re: How to update UI from a background thread

2016-09-21 Thread Jens Alfke
> On Sep 21, 2016, at 10:13 AM, Doug Hill wrote: > > The symptoms you mention sound like a classic deadlock problem. That is, a > code block running on the main queue schedules another code block on the main > queue, but the original block never completes thus causing the app to hang or > the

<    1   2   3   4   5   6   7   8   9   10   >