Post

Replies

Boosts

Views

Activity

Spotlight/metadata can be so very annoying
sef% mdls /Applications/Google\ Chrome.app/Contents/Frameworks/Google\ Chrome\ Framework.framework/Versions/112.0.5615.137/Helpers/Google\ Chrome\ Helper.app kMDItemFSContentChangeDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreationDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = 0 kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = 0 kMDItemFSLabel = 0 kMDItemFSName = "Google Chrome Helper.app" kMDItemFSNodeCount = 1 kMDItemFSOwnerGroupID = 0 kMDItemFSOwnerUserID = 0 kMDItemFSSize = 1 kMDItemFSTypeCode = "" sef% mdfind 'kMDItemFSName == "Google Chrome Helper.app"' So there's a metadata key that has a value... but mdfind won't find it. I haven't tried writing a small program to see if it would find it yet, although I am somewhat curious if it would.
0
0
883
May ’23
Sonoma on a virtual machine?
I don't have enough physical machines to install Sonoma; I do, however, have lots of CPU cycles, memory, and disk space -- so can I get Sonoma running in VMWare Fusion? Ideally on both AS and Intel. I searched to see if this had been asked, but I will be the first to admit my searching skills are bad. (This is why I like find and grep.)
3
0
2.6k
Sep ’23
Keeping track of thread creation in a process
In some cases, one of our daemons will end up with thousands of threads. Clearly a bug somewhere, but I can't see it in the code. (Admittedly, it's C++ which is a bit alien to me still. Anyway.) If I wanted to just be notified each time a thread was created in the process, what are some ways to do that? I assume dtrace and lldb have ways to od it, but I'm not quite sure what.
6
0
1.1k
Jul ’23
Not being prompted when removing a root CA
We have our own root CA that is installed with our application. For non-MDM installs, the system asks if the user wants to do that, which is all well and good. It also used to ask us when removing that certificate. It doesn't now. So now I am wondering if I dreamed it, except other people say they also got prompted and don't now. It's being installed and removed using the security command, in scripts.
1
0
879
Aug ’23
Can I tell if a system is awake/asleep?
macOS, really, so there are a bunch of things that may be running during various types of sleep. I know I can get notifications from IOKit about the system going to sleep or waking up, but if I've got a daemon that crashed, and is then relaunched automatically, can I tell whether the machine is awake, or in some sort of sleep state other than hibernation?
0
0
636
Aug ’23
This doesn't seem like correct behaviour for ASWebAuthenticationSession?
I just wrote code for our app to use ASWebAuthenticationSession for 3rd-party authentication (in particular, YUBIKEYS WOOHOO). Our app registers a URI scheme of x-com-kithrup for launch services events, so I used x-com-kithrup-yubi for ASWebAUthenticationSession. Only, I didn't change the back end, so it still redirects to x-com-kithrup://success on a successful login. And... ASWebAuthenticationSession is still calling the handler when it gets a URL with the x-com-kithrup URI, instead of the x-com-kithrup-yubi URI scheme.
1
0
540
Sep ’23
SwiftUI, FetchedResults, and uninitliazed?
I've got @Environment(\.managedObjectContext) var context private var home: Home private var predicate: NSPredicate @State var sortBy: SortDescriptor<Room> @FetchRequest private var rooms: FetchedResults<Room> init(home: Home) { self.home = home _sortBy = State(initialValue: SortDescriptor<Room>(\.name)) self.predicate = NSPredicate(format: "%K = %@", "home", self.home) _rooms = FetchRequest<Room>( sortDescriptors: [self.sortBy], predicate: self.predicate) } But it won't compile -- it says Variable 'self.rooms' used before being initialized. But... how?
2
0
612
Sep ’23
DatePicker behaving strangely
I was trying to have a date picker show up conditionally; it seems to work for iOS, but macOS (13, haven't tried it on 14 yet) it ... doesn't. In particular, if I select "custom" in this code, and then click on a date part, it brings up the graphical picker, and I can select a date, but then... it doesn't go away. Clearly I am doing something wrong, but is it clear to anyone who isn't me what that is? import SwiftUI extension View { /// Hide or show the view based on a boolean value. /// /// Example for visibility: /// /// Text("Label") /// .isHidden(true) /// /// Example for complete removal: /// /// Text("Label") /// .isHidden(true, remove: true) /// /// - Parameters: /// - hidden: Set to `false` to show the view. Set to `true` to hide the view. /// - remove: Boolean value indicating whether or not to remove the view. @ViewBuilder func isHidden(_ hidden: Bool, remove: Bool = false, disable: Bool = false) -> some View { if hidden { if !remove { self.hidden() .disabled(disable) } } else { self } } } enum ExpireType: CustomStringConvertible, Hashable, CaseIterable { case never case oneWeek case twoWeek case oneMonth case sixMonth case custom func expires(given date: Date) -> Date? { let calendar = Calendar.current switch self { case .never: return nil case .custom: return nil case .oneWeek: return calendar.date(byAdding: .weekOfYear, value: 1, to: Date()) case .twoWeek: return calendar.date(byAdding: .weekOfYear, value: 2, to: Date()) case .oneMonth: return calendar.date(byAdding:.month, value: 1, to: Date()) case .sixMonth: return calendar.date(byAdding: .month, value: 6, to: Date()) } } var description: String { switch self { case .never: return "Never" case .custom: return "Custom" case .oneWeek: return "One week" case .twoWeek: return "Two weeks" case .oneMonth: return "One month" case .sixMonth: return "Six months" } } } struct ExpireDatePicker: View { @State var expires = Date() @State var expireType = ExpireType.never @State var didChange = false @State var dateString = "" @State var showDatePicker = false private func updateText() { if self.expireType == .never { self.dateString = "" } else if self.expireType == .custom { self.dateString = self.expires.formatted(.dateTime.day().month().year()) } else { self.dateString = self.expireType.expires(given: Date())!.formatted(.dateTime.day().month().year()) } } /* * For the expire date, we want to let * the user pick one of the predfined dates, * or a custom date. */ var body: some View { VStack(alignment: .trailing) { let _ = print("showDatePicker \(self.showDatePicker)") Picker("Expiration date", selection: self.$expireType) { ForEach(ExpireType.allCases, id: \.self) { et in Text(String(describing: et)) .tag(et) } } ZStack(alignment: .trailing) { Text(dateString) .fontWeight(.ultraLight) .isHidden(self.showDatePicker, disable: true) /* * This does not work well. * I can't get it to disappear, * or relinquish control */ DatePicker("", selection: self.$expires, displayedComponents: .date) .datePickerStyle(.compact) .isHidden(!self.showDatePicker, disable: true) } } .onChange(of: self.expireType) { to in self.showDatePicker = (to == .custom) self.updateText() } .onChange(of: self.expires) { to in print("expires changed to \(self.expires)") self.showDatePicker = false } } }
1
0
801
Sep ’23
Is there a way to tell if our app was installed via MDM?
Title says it all -- there are a couple of things we might do differently during upgrades, but also we'd like to know for our own statistics. This is on macOS, so we can use /usr/bin/profiles, but I was curious if there was a way to tell programmatically that didn't involves system() or posix_spawn().
Replies
0
Boosts
0
Views
419
Activity
Apr ’23
Prevent certificate trust settings changes?
We include a root CA with our product. Is there a way to prevent a user from changing the trust settings? I couldn't find anything, but as this is on the outer edge of my current knowledge set, it's just as likely that I missed something.
Replies
0
Boosts
0
Views
550
Activity
May ’23
Spotlight/metadata can be so very annoying
sef% mdls /Applications/Google\ Chrome.app/Contents/Frameworks/Google\ Chrome\ Framework.framework/Versions/112.0.5615.137/Helpers/Google\ Chrome\ Helper.app kMDItemFSContentChangeDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreationDate = 2023-04-17 23:59:16 +0000 kMDItemFSCreatorCode = "" kMDItemFSFinderFlags = 0 kMDItemFSHasCustomIcon = 0 kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSIsStationery = 0 kMDItemFSLabel = 0 kMDItemFSName = "Google Chrome Helper.app" kMDItemFSNodeCount = 1 kMDItemFSOwnerGroupID = 0 kMDItemFSOwnerUserID = 0 kMDItemFSSize = 1 kMDItemFSTypeCode = "" sef% mdfind 'kMDItemFSName == "Google Chrome Helper.app"' So there's a metadata key that has a value... but mdfind won't find it. I haven't tried writing a small program to see if it would find it yet, although I am somewhat curious if it would.
Replies
0
Boosts
0
Views
883
Activity
May ’23
Getting the URL for an EKSource calDAV object?
I searched and couldn't find anything, which shocks me, I can't be the only person to ask this. Therefore my search skills are once again demonstrated to be weak. Given an EKCalendar, I can get the source thence sourceIdentifier... but that's just a UUID; can I get the actual URL for that? I assume it's somewhere?
Replies
1
Boosts
0
Views
829
Activity
Jun ’23
Reset the security&privacy settings for a macOS app?
Playing with EventKit, I wanted to test requesting access. Which I did once. Yay. Now it's stuck in System Settings... and I don't know how to reset it. (This is on Ventura.)
Replies
1
Boosts
0
Views
1k
Activity
May ’23
Sonoma on a virtual machine?
I don't have enough physical machines to install Sonoma; I do, however, have lots of CPU cycles, memory, and disk space -- so can I get Sonoma running in VMWare Fusion? Ideally on both AS and Intel. I searched to see if this had been asked, but I will be the first to admit my searching skills are bad. (This is why I like find and grep.)
Replies
3
Boosts
0
Views
2.6k
Activity
Sep ’23
Keeping track of thread creation in a process
In some cases, one of our daemons will end up with thousands of threads. Clearly a bug somewhere, but I can't see it in the code. (Admittedly, it's C++ which is a bit alien to me still. Anyway.) If I wanted to just be notified each time a thread was created in the process, what are some ways to do that? I assume dtrace and lldb have ways to od it, but I'm not quite sure what.
Replies
6
Boosts
0
Views
1.1k
Activity
Jul ’23
SwiftData and command line
Is it possible to use SwiftData in a CLI tool, or is it only designed to work with SwiftUI?
Replies
13
Boosts
0
Views
3.3k
Activity
Jan ’24
This output from Instruments doesn't make a lot of sense to me...
This seems to show that a bunch of memory being allocated in... mach_vm_deallocate. That doesn't seem likely, so I have to assume I'm misreading the output? (This is on macOS.)
Replies
4
Boosts
1
Views
923
Activity
Sep ’23
Not being prompted when removing a root CA
We have our own root CA that is installed with our application. For non-MDM installs, the system asks if the user wants to do that, which is all well and good. It also used to ask us when removing that certificate. It doesn't now. So now I am wondering if I dreamed it, except other people say they also got prompted and don't now. It's being installed and removed using the security command, in scripts.
Replies
1
Boosts
0
Views
879
Activity
Aug ’23
Can I tell if a system is awake/asleep?
macOS, really, so there are a bunch of things that may be running during various types of sleep. I know I can get notifications from IOKit about the system going to sleep or waking up, but if I've got a daemon that crashed, and is then relaunched automatically, can I tell whether the machine is awake, or in some sort of sleep state other than hibernation?
Replies
0
Boosts
0
Views
636
Activity
Aug ’23
This doesn't seem like correct behaviour for ASWebAuthenticationSession?
I just wrote code for our app to use ASWebAuthenticationSession for 3rd-party authentication (in particular, YUBIKEYS WOOHOO). Our app registers a URI scheme of x-com-kithrup for launch services events, so I used x-com-kithrup-yubi for ASWebAUthenticationSession. Only, I didn't change the back end, so it still redirects to x-com-kithrup://success on a successful login. And... ASWebAuthenticationSession is still calling the handler when it gets a URL with the x-com-kithrup URI, instead of the x-com-kithrup-yubi URI scheme.
Replies
1
Boosts
0
Views
540
Activity
Sep ’23
SwiftUI, FetchedResults, and uninitliazed?
I've got @Environment(\.managedObjectContext) var context private var home: Home private var predicate: NSPredicate @State var sortBy: SortDescriptor<Room> @FetchRequest private var rooms: FetchedResults<Room> init(home: Home) { self.home = home _sortBy = State(initialValue: SortDescriptor<Room>(\.name)) self.predicate = NSPredicate(format: "%K = %@", "home", self.home) _rooms = FetchRequest<Room>( sortDescriptors: [self.sortBy], predicate: self.predicate) } But it won't compile -- it says Variable 'self.rooms' used before being initialized. But... how?
Replies
2
Boosts
0
Views
612
Activity
Sep ’23
DatePicker behaving strangely
I was trying to have a date picker show up conditionally; it seems to work for iOS, but macOS (13, haven't tried it on 14 yet) it ... doesn't. In particular, if I select "custom" in this code, and then click on a date part, it brings up the graphical picker, and I can select a date, but then... it doesn't go away. Clearly I am doing something wrong, but is it clear to anyone who isn't me what that is? import SwiftUI extension View { /// Hide or show the view based on a boolean value. /// /// Example for visibility: /// /// Text("Label") /// .isHidden(true) /// /// Example for complete removal: /// /// Text("Label") /// .isHidden(true, remove: true) /// /// - Parameters: /// - hidden: Set to `false` to show the view. Set to `true` to hide the view. /// - remove: Boolean value indicating whether or not to remove the view. @ViewBuilder func isHidden(_ hidden: Bool, remove: Bool = false, disable: Bool = false) -> some View { if hidden { if !remove { self.hidden() .disabled(disable) } } else { self } } } enum ExpireType: CustomStringConvertible, Hashable, CaseIterable { case never case oneWeek case twoWeek case oneMonth case sixMonth case custom func expires(given date: Date) -> Date? { let calendar = Calendar.current switch self { case .never: return nil case .custom: return nil case .oneWeek: return calendar.date(byAdding: .weekOfYear, value: 1, to: Date()) case .twoWeek: return calendar.date(byAdding: .weekOfYear, value: 2, to: Date()) case .oneMonth: return calendar.date(byAdding:.month, value: 1, to: Date()) case .sixMonth: return calendar.date(byAdding: .month, value: 6, to: Date()) } } var description: String { switch self { case .never: return "Never" case .custom: return "Custom" case .oneWeek: return "One week" case .twoWeek: return "Two weeks" case .oneMonth: return "One month" case .sixMonth: return "Six months" } } } struct ExpireDatePicker: View { @State var expires = Date() @State var expireType = ExpireType.never @State var didChange = false @State var dateString = "" @State var showDatePicker = false private func updateText() { if self.expireType == .never { self.dateString = "" } else if self.expireType == .custom { self.dateString = self.expires.formatted(.dateTime.day().month().year()) } else { self.dateString = self.expireType.expires(given: Date())!.formatted(.dateTime.day().month().year()) } } /* * For the expire date, we want to let * the user pick one of the predfined dates, * or a custom date. */ var body: some View { VStack(alignment: .trailing) { let _ = print("showDatePicker \(self.showDatePicker)") Picker("Expiration date", selection: self.$expireType) { ForEach(ExpireType.allCases, id: \.self) { et in Text(String(describing: et)) .tag(et) } } ZStack(alignment: .trailing) { Text(dateString) .fontWeight(.ultraLight) .isHidden(self.showDatePicker, disable: true) /* * This does not work well. * I can't get it to disappear, * or relinquish control */ DatePicker("", selection: self.$expires, displayedComponents: .date) .datePickerStyle(.compact) .isHidden(!self.showDatePicker, disable: true) } } .onChange(of: self.expireType) { to in self.showDatePicker = (to == .custom) self.updateText() } .onChange(of: self.expires) { to in print("expires changed to \(self.expires)") self.showDatePicker = false } } }
Replies
1
Boosts
0
Views
801
Activity
Sep ’23
Dumb question about pf
Is it actually usable as a fireawall in macOS? I tried (as an example) adding a rule to block port 80, and it did not seem to work. But, that's all I tried -- just added a line to /etc/pf.conf
Replies
4
Boosts
0
Views
754
Activity
Sep ’23