How to avoid swift.retain/release

2016-09-08 Thread Gerriet M. Denkmann
This code executes in a strange way: SubClass takes much longer than BaseClass. class BaseClass { let hugeNumber: Int var bitfield: UnsafeMutablePointer init() { hugeNumber = 1_000_000_000 bitfield = calloc( hugeNumber, 1) }

How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
I have a pure Swift class. I want to do: if self.dynamicType == SomeClass { … } But the compiler won’t accept this (or any number of variations thereof). isKindOfClass needs a “class object representing the Objective-C class to be tested”. How can this be done? Gerriet. _

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 14:27, Quincey Morris > wrote: > > On Sep 12, 2016, at 00:08 , Gerriet M. Denkmann wrote: >> >> I want to do: >> if self.dynamicType == SomeClass { … } >> >> But the compiler won’t accept this (or any number of variations ther

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 14:55, Quincey Morris > wrote: > > On Sep 12, 2016, at 00:50 , Gerriet M. Denkmann wrote: >> >> I would much prefer to have the semantics of “isKindOf”. > > Yes, I know, that’s why you should be using: > > if self is SArray &

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 15:10, Quincey Morris > wrote: > > On Sep 12, 2016, at 01:00 , Gerriet M. Denkmann wrote: >> >> This is what I wanted to write: >> >> if self is SArray { … } >> But the compiler warns me: Cast from ‘SBase.Type’ to unrelated type

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 15:51, Quincey Morris > wrote: > > On Sep 12, 2016, at 01:32 , Gerriet M. Denkmann wrote: >> >> In my real (as opposed to playground) code, each class lives in a different >> file. > > I just tried it with classes in different fil

Swift and Threads

2016-09-12 Thread Gerriet M. Denkmann
This function works flawlessly in Release build: func markAndTell( talk: Bool, number: Int) { let nbrOfThreads = 8 let step = 2 let itemsPerThread = number * step let bitLimit = nbrOfThreads * itemsPerThread var bitfield = [Bool](count: bitLimit, repeatedVal

Re: How to do isKindOfClass in Swift

2016-09-12 Thread Gerriet M. Denkmann
> On 13 Sep 2016, at 00:14, Quincey Morris > wrote: > > On Sep 12, 2016, at 03:17 , Gerriet M. Denkmann wrote: >> >> The I got back to the real project: and could also not reproduce it there. >> >> One explanation: working with Swift, I quite often (

Re: Swift and Threads

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 22:49, Jens Alfke wrote: > > >> 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

Re: Swift and Threads

2016-09-12 Thread Gerriet M. Denkmann
> On 12 Sep 2016, at 22:49, Jens Alfke wrote: > > >> 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

Re: Swift and Threads

2016-09-13 Thread Gerriet M. Denkmann
> On 13 Sep 2016, at 14:14, Stephen J. Butler wrote: > > This site suggests a version using withUnsafeMutableBufferPointer: > > http://blog.human-friendly.com/swift-arrays-are-not-threadsafe > > let nbrOfThreads = 8 > let step = 2 > let itemsPerThread = number * step > let bitLimit = nbrOfThre

Re: Swift and Threads

2016-09-13 Thread Gerriet M. Denkmann
> On 13 Sep 2016, at 15:20, Quincey Morris > wrote: > >> On Sep 13, 2016, at 00:57 , Gerriet M. Denkmann wrote: >> >> I was struggling to find a solution which is thread safe. > > Your problem didn’t really need thread safety, though. There appeared to be &

Mystery Threads

2016-09-29 Thread Gerriet M. Denkmann
I have a big array (like a few GB) which is operated upon by some functions. As these functions act purely local, an obvious idea is: - (void)someFunction { nbrOfThreads = ... sizeOfBigArray = ... a few GB stride = sizeOfBigArray / nbrOfThreads dispatch_ap

Re: Mystery Threads

2016-09-29 Thread Gerriet M. Denkmann
> On 29 Sep 2016, at 14:38, Quincey Morris > wrote: > > On Sep 29, 2016, at 00:15 , Gerriet M. Denkmann wrote: >> >> dispatch_apply( nbrOfThreads, queue, ^void(size_t idx) >> >> As my computer has just 8 CPUs, I thought that using nbrOfThreads >

Re: Mystery Threads

2016-09-29 Thread Gerriet M. Denkmann
> On 29 Sep 2016, at 15:34, Quincey Morris > wrote: > > On Sep 29, 2016, at 01:05 , Gerriet M. Denkmann wrote: >> >> Well, nothing. Just let’s call it nbrOfBlocksToBeUsedByDispatchApply, or >> whatever. But ultimately any of these things has to run on a CPU,

Re: Mystery Threads

2016-09-30 Thread Gerriet M. Denkmann
> On 29 Sep 2016, at 16:05, Roland King wrote: > > >> On 29 Sep 2016, at 16:59, Gerriet M. Denkmann wrote: >> >> >>> On 29 Sep 2016, at 15:34, Quincey Morris >>> wrote: >>> >> >> Well, I count this as (bigArea = 4 GB)

Re: Mystery Threads

2016-10-01 Thread Gerriet M. Denkmann
> On 1 Oct 2016, at 01:33, Quincey Morris > wrote: > > On Sep 30, 2016, at 02:57 , Gerriet M. Denkmann wrote: > >> Any ideas where to look for a reason? > > The next step is probably to clarify the times between: > > a. Accumulated execution time — the

Where are the ICU Headers?

2016-10-06 Thread Gerriet M. Denkmann
The Icu stuff (57.1) is included in macOS 12. There is: /usr/lib/libicucore.A.dylib and Xcode has: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libicucore.tbd But I cannot find the headers. Gerriet. _

How to count Atoms

2016-10-07 Thread Gerriet M. Denkmann
I need (just for debugging purposes) to count something in a thread safe way. This works, but is deprecated: SInt32 counter; - (IBAction)doSomething:sender { counter = 0; some loop { IncrementAtomic( &counter );// 'IncrementAtomic' is d

Re: How to count Atoms

2016-10-07 Thread Gerriet M. Denkmann
> On 7 Oct 2016, at 15:43, Ken Thomases wrote: > > On Oct 7, 2016, at 2:19 AM, Gerriet M. Denkmann wrote: >> >> I need (just for debugging purposes) to count something in a thread safe >> way. >> […] >> So I tried OSIncrementAtomic. >>

Re: How to count Atoms

2016-10-07 Thread Gerriet M. Denkmann
> On 7 Oct 2016, at 15:14, Quincey Morris > wrote: > > On Oct 7, 2016, at 00:19 , Gerriet M. Denkmann wrote: >> >> So what is the proper way to count something atomicly and undeprecatedly? > > One straightforward way is to use dispatch_semaphore. IIRC it’s l

Logging in macOS 12

2016-10-07 Thread Gerriet M. Denkmann
Some app with NSLog (not running in Xcode) does not show anything in Console.app. Only when Iog in as administrator I can see the NSLog lines. Is this working as expected? Can anything be done to make common people see the NSLog lines too? Gerriet. ___

Re: Logging in macOS 12

2016-10-07 Thread Gerriet M. Denkmann
> On 7 Oct 2016, at 23:18, Jens Alfke wrote: > > >> On Oct 7, 2016, at 7:56 AM, Gerriet M. Denkmann wrote: >> >> Some app with NSLog (not running in Xcode) does not show anything in >> Console.app. >> Only when Iog in as administrator I can see

Re: How to count Atoms

2016-10-07 Thread Gerriet M. Denkmann
> On 8 Oct 2016, at 05:01, Quincey Morris > wrote: > > On Oct 7, 2016, at 07:49 , Gerriet M. Denkmann wrote: >> >> Is there a better way than this: >> dsema = dispatch_semaphore_create( 0 ); >> >> some loop to be counted &g

Re: How to count Atoms

2016-10-07 Thread Gerriet M. Denkmann
> On 8 Oct 2016, at 11:22, Quincey Morris > wrote: > > On Oct 7, 2016, at 21:06 , Gerriet M. Denkmann wrote: >> >> But, alas, it is also much slower: overhead almost 40 sec (whereas my >> admittedly rather hackish way took less then half a second). > > T

HandOff Problems

2016-10-13 Thread Gerriet M. Denkmann
I have two apps for macOS 12 and iOS 10 which should do HandOff. HandOff works ok between iOS devices. It once worked from any iOS device to Mac. (Never worked from Mac to an iOS device). Until recently it worked from iPad to Mac (but not from iPhone to Mac). Then I rebooted the Mac, and now eve

Re: HandOff Problems

2016-10-13 Thread Gerriet M. Denkmann
’t there something like “It just works” ? Only: HandOff from Mac to iOS devices is still not working. No idea why. Gerriet. > > On Thu, Oct 13, 2016 at 7:40 AM, Gerriet M. Denkmann > wrote: > I have two apps for macOS 12 and iOS 10 which should do HandOff. > HandOff works ok bet

Re: HandOff Problems

2016-10-14 Thread Gerriet M. Denkmann
> On 13 Oct 2016, at 23:59, Gerriet M. Denkmann wrote: > >> On 13 Oct 2016, at 20:02, Charles Jenkins wrote: >> >> I don’t have any answers, but please keep us posted. Sierra is the first >> macOS upgrade that proved to be a complete disappointment to me, b

observeValueForKeyPath:... called too often in macOS 12

2016-10-14 Thread Gerriet M. Denkmann
My app (macOS 12) observes a value in NSUserDefaults. Starting with macOS 12 observeValueForKeyPath:… is called at the start of the program, although nothing has changed yet. When the value actually changes, it is called twice. Also: NSKeyValueObservingOptionNew or NSKeyValueObservingOptionOld j

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-18 Thread Gerriet M. Denkmann
> On 19 Oct 2016, at 02:00,Jerome Krinock : > >> On 2016 Oct 14, at 23:08, Gerriet M. Denkmann wrote: >> >> My app (macOS 12) observes a value in NSUserDefaults. Starting with macOS >> 12 observeValueForKeyPath:… is called at the start of the program, althou

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-18 Thread Gerriet M. Denkmann
ect. Kind regards, Gerriet. > These are things I’ve seen that can cause uncharacteristically often updates. > -- > Gary L. Wade > http://www.garywade.com/ > >> On Oct 18, 2016, at 7:32 PM, Gerriet M. Denkmann wrote: >> >> >>> On 19 Oct 2016, at 02:00,

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-18 Thread Gerriet M. Denkmann
> On 19 Oct 2016, at 11:43,Jerome Krinock wrote: > > >> On 2016 Oct 18, at 19:32, Gerriet M. Denkmann wrote: >> >> >>> On 19 Oct 2016, at 02:00,Jerome Krinock : >>> >>>> On 2016 Oct 14, at 23:08, Gerriet M. Denkman

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-18 Thread Gerriet M. Denkmann
> On 19 Oct 2016, at 13:01, Quincey Morris > wrote: > > On Oct 18, 2016, at 22:33 , Gerriet M. Denkmann wrote: >> >> I have just done this (can send it to you if you are interested). > > I’d be interested at looking at it, if you can email it to me.

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-19 Thread Gerriet M. Denkmann
> On 19 Oct 2016, at 13:01, Quincey Morris > wrote: > > > One way around this is to use a NSObjectController bound between the text > field and the data model (user defaults in this case). NSObjectController > implements the editor protocols, so this covers the case where the window > close

Re: observeValueForKeyPath:... called too often in macOS 12

2016-10-19 Thread Gerriet M. Denkmann
> On 19 Oct 2016, at 15:08, Quincey Morris > wrote: > > On Oct 19, 2016, at 00:49 , Gerriet M. Denkmann wrote: >> >> Before: >> >> TextField1 bound Value to: >> Shared User Defaults Controller >> Controller Key = values >>

How to show a file in Finder

2016-10-31 Thread Gerriet M. Denkmann
I want to show a file in Finder (not open it in some application). I tried: NSString *path = @“/some/thing.plist”; [ sharedWorkspace openFile: path withApplication: @“Finder.app" ] but this opens Xcode and displays the content of path. I just want a Finder window with my path se

Re: How to show a file in Finder

2016-10-31 Thread Gerriet M. Denkmann
t; Phil > > >> On 31 Oct 2016, at 17:00, Gerriet M. Denkmann wrote: > > >> >> >> I want to show a file in Finder (not open it in some application). >> >> I tried: >> NSString *path = @“/some/thing.plist”; >> [ sharedW

How to get an undeprecated FSRef

2016-11-01 Thread Gerriet M. Denkmann
I am using ReadIconFromFSRef (not deprecated), which needs an FSRef. How to convert a path into an FSRef without deprecation warnings in macOS 12 ? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: How to get an undeprecated FSRef

2016-11-01 Thread Gerriet M. Denkmann
> On 1 Nov 2016, at 14:44, Ken Thomases wrote: > > On Nov 1, 2016, at 2:08 AM, Gerriet M. Denkmann wrote: >> >> I am using ReadIconFromFSRef (not deprecated), which needs an FSRef. >> >> How to convert a path into an FSRef without deprecation warnings in m

Re: How to get an undeprecated FSRef

2016-11-01 Thread Gerriet M. Denkmann
> On 1 Nov 2016, at 15:25, Ken Thomases wrote: > > On Nov 1, 2016, at 3:20 AM, Gerriet M. Denkmann wrote: >> >> What I really want to do: Create custom icons for folders programmatically. > > Use -[NSWorkspace setIcon:forFile:options:]. > > Regards, > Ke

How to ResolvingSymlinksInPath ?

2016-11-02 Thread Gerriet M. Denkmann
I want to remove all symlinks from a path. stringByResolvingSymlinksInPath does NOT do this (e.g. it does not change: /tmp to: /private/tmp). Currently I am using: int fd = open( filename, O_EVTONLY ); fcntl( fd, F_GETPATH, buffer ); close(fd); Is there something better or more suitable? macOS

Re: How to ResolvingSymlinksInPath ?

2016-11-02 Thread Gerriet M. Denkmann
> On 2 Nov 2016, at 20:40, Stephane Sudre wrote: > > https://www.cocoawithlove.com/2010/02/resolving-path-containing-mixture-of.html I finally came up with this (all error checking removed): - (NSString *)resolvedPathFor: (NSString *)rawPath { NSURL *url = [ NSURL fileURLWithPath: rawP

Re: How to ResolvingSymlinksInPath ?

2016-11-03 Thread Gerriet M. Denkmann
> On 3 Nov 2016, at 23:05, Jens Alfke wrote: > > The docs for -stringByResolvingSymlinksInPath say that “for absolute paths, > all symbolic links are guaranteed to be removed.” If it doesn’t actually do > that, then there’s either a bug in the implementation or a bug in the docs; > either way

Re: How to ResolvingSymlinksInPath ?

2016-11-03 Thread Gerriet M. Denkmann
> On 4 Nov 2016, at 10:39, Ken Thomases wrote: > > On Nov 3, 2016, at 10:08 PM, Gerriet M. Denkmann wrote: >> >> URLByResolvingAliasFileAtURL does almost the same, has no special behaviour >> with “/private”, and even can resolve an alias. >> But: only when

Fonts in TableView

2016-11-05 Thread Gerriet M. Denkmann
macOS 12.1 TableView and OutlineView (View Based) use: - (void)awakeFromNib NSRect boundingRect = tableFont.boundingRectForFont; self.outlineView.rowHeight = ceil( boundingRect.size.height ) and sets attributedStringValue (using the tableFont). This works mostly ok. But for ta

Re: Fonts in TableView

2016-11-06 Thread Gerriet M. Denkmann
> On 6 Nov 2016, at 13:18, Quincey Morris > wrote: > > On Nov 5, 2016, at 21:44 , Gerriet M. Denkmann wrote: >> >> NSRect boundingRect = tableFont.boundingRectForFont; >> self.outlineView.rowHeight = ceil( boundingRect.size.height ) > > This is

Re: Fonts in TableView

2016-11-07 Thread Gerriet M. Denkmann
> On 7 Nov 2016, at 16:43, Alastair Houghton > wrote: > > On 6 Nov 2016, at 06:18, Quincey Morris > wrote: > >> There is probably no perfect strategy that works for every font. However, >> for the kinds of design decisions that Apple made when it started doing >> typography properly (in th

AutoSave for Windows

2016-11-21 Thread Gerriet M. Denkmann
macOS 12.1, Xcode Version 8.1 (8T61a). App with two windows: FestEvent and Preferences, which have Autosave names of FestEvent, resp. Preferences. Start App → FestEvent window will show. Make it to show Preferences window as well. Move both windows around and observe Preferences.plist to have a

Re: AutoSave for Windows

2016-11-22 Thread Gerriet M. Denkmann
> On 22 Nov 2016, at 23:07,Andreas Mayer wrote: > >> Am 22.11.2016 um 07:34 schrieb Gerriet M. Denkmann : >> >> But now some obnoxious NSPersistentUIRestorer takes over: > > The docs say window restoration uses the window's identifier. Is that one set &g

Vertically Centered Colon

2016-11-28 Thread Gerriet M. Denkmann
iOS 10.1.1 WWDC 2015,Session 804: Introducing the New System Fonts tells (at about 23:23) about Vertically Centered Colons. But I do not understand, how to turn this on. It works automatically (in SF) with colons surrounded by digits. But in my case I have “21:37:44” where ““21:37” is bold and

Re: Vertically Centered Colon

2016-11-28 Thread Gerriet M. Denkmann
thinking of UIFontDescriptorFeatureSettingsAttribute with some Feature type from SFNTLayoutTypes.h (in CoreText). I tried a few types, but no success so far. > > On Mon, Nov 28, 2016 at 10:02 AM Gerriet M. Denkmann > wrote: > iOS 10.1.1 > > WWDC 2015,Session 804: Introducing the New System Fonts tells (at ab

Re: Vertically Centered Colon

2016-11-28 Thread Gerriet M. Denkmann
> On 29 Nov 2016, at 00:40, Quincey Morris > wrote: > > On Nov 28, 2016, at 07:01 , Gerriet M. Denkmann wrote: >> >> But in my case I have “21:37:44” where ““21:37” is bold and “:44” is thin. > > a. Are you using an attributed string whose text is “21:37:44”,

Re: Vertically Centered Colon

2016-11-28 Thread Gerriet M. Denkmann
> On 28 Nov 2016, at 23:42, Alastair Houghton > wrote: > > On 28 Nov 2016, at 16:18, Gerriet M. Denkmann wrote: >> >> >>> On 28 Nov 2016, at 22:13, Eric E. Dolecki wrote: >>> >>> You could probably use an attributed

Re: Vertically Centered Colon

2016-11-29 Thread Gerriet M. Denkmann
red colons on. So now I have two working solutions: 1. getting the special glyph for the centered colon (as suggested by Alistair) and: 2. using kStylisticAltThreeOnSelector (as suggested by you). Thanks a lot. The hint of “kStylisticAlternativesType” was extremely helpful! Kind regards, Gerriet.

Re: Vertically Centered Colon

2016-11-29 Thread Gerriet M. Denkmann
> On 29 Nov 2016, at 00:40, Quincey Morris > wrote: > > On Nov 28, 2016, at 07:01 , Gerriet M. Denkmann wrote: >> >> But in my case I have “21:37:44” where ““21:37” is bold and “:44” is thin. > > > c. Given that you work so much with non-Latin scripts,

Re: Vertically Centered Colon

2016-11-29 Thread Gerriet M. Denkmann
> On 30 Nov 2016, at 09:18, Doug Hill wrote: > > >> On Nov 29, 2016, at 3:58 PM, Rick Mann wrote: >> >> >>> On Nov 29, 2016, at 09:38 , Doug Hill wrote: >>> >>> Wow, it's awesome that this works! And now that I know how to set these >>> attributes for a UILabel, I might try using some oth

Where are the gears?

2016-11-30 Thread Gerriet M. Denkmann
I want a UIBarButtonItem with a picture of gears, being used to mean “Settings”. This symbol is used by many apps for this function; but I cannot find this image. Where is it hiding? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) P

Re: Where are the gears?

2016-11-30 Thread Gerriet M. Denkmann
> On 30 Nov 2016, at 15:33, Alex Zavatone wrote: > > I made my own since this has been removed. > > I'll send you a few. Is Illustrator or PDF or PNG OK? Pdf or Png would be fine. Thanks a lot! Kind regards, Gerriet. ___ Cocoa-dev mailing lis

Re: Where are the gears?

2016-12-01 Thread Gerriet M. Denkmann
oster wanted. > -- > Gary L. Wade > http://www.garywade.com/ > >> On Nov 30, 2016, at 9:55 AM, Richard Charles wrote: >> >> >>> On Nov 30, 2016, at 1:29 AM, Gerriet M. Denkmann >>> wrote: >>> >>> I want a UIBarButtonItem with a pi

Message from iOS to watchOS

2016-12-02 Thread Gerriet M. Denkmann
I have a pair of apps: iOS + watchOS. The iOS app would like (e.g. when the user taps a button) to send some (short) info to the watchOS app. The watchOS app probably should show something like a Notification Controller Scene: Message from iOS (title) Something was done (bod

Re: Message from iOS to watchOS

2016-12-04 Thread Gerriet M. Denkmann
between iOS app and watchOS app? Gerriet. > >> Date: Sat, 03 Dec 2016 13:48:31 +0700 >> From: "Gerriet M. Denkmann" >> To: cocoa-dev >> Subject: Message from iOS to watchOS >> Message-ID: <2001a5e8-10f8-4b30-86c4-9dfee6198...@icloud.com> >> Content-T

Re: Message from iOS to watchOS

2016-12-04 Thread Gerriet M. Denkmann
s with a UNNotificationCategory with the same category: “my test category”. This might indicate possibility “C”: local notifications are local to the sending app. Or it may just be a proof that I am doing it wrong. > > Communicate between watchOS, and iPhone: To be investigated later.

Re: Message from iOS to watchOS

2016-12-06 Thread Gerriet M. Denkmann
hOS app and the iOS device is locked and the watch is not locked then the Notification is sent also to the watch (and the iOS does not get woken up). Gerriet. > > Scott Tury > >> On Dec 5, 2016, at 12:17 AM, Gerriet M. Denkmann wrote: >> >> >>> On 5 Dec

watchOS

2016-12-06 Thread Gerriet M. Denkmann
watchOS 3 The watchApp has NotificationController ← WKUserNotificationInterfaceController watchApp gets a Local Notification with one associated UNNotificationAction with title = “Accept” [NotificationController init] [NotificationController didReceiveNotification:withCompletion:] [Notification

Requires High Performance Graphic Card - Why?

2016-12-15 Thread Gerriet M. Denkmann
macOS 12.2; MacBook Pro (Retina, Mid 2012). Activity Monitor → Energy tells me that my app requires a "High Performance Graphic Card”. The problem: it has absolutely no reason to do so. The app does some WiFi stuff and displays the result in a window. There is almost no graphics (except from so

NSNetServiceBrowser vs. mDNSResponder

2017-01-13 Thread Gerriet M. Denkmann
iOS (10.2) app does: SERVICE_TYPE = 1 to 63 ascii chars; no spaces; no ‘.’; no ‘[‘; can use ‘_' or '-'; case insensitive Note: I did not find these rules documented anywhere, they are just the result of trial and error. fullNameOfServiceType = “_SERVICE_TYPE._tcp." [ NSNetServiceBrowser search

Locale in Watch

2017-02-16 Thread Gerriet M. Denkmann
I use WKInterfaceDate / WKInterfaceTimer in a wach app (3.1.3). I would like to set the Locale - but see no way to do so. The only thing I did accomplish is to set the calendar of WKInterfaceDate according to the locale. In macOS I would use: NSDateFormatter *dateFormatter = [ [ NSDateFormatte

Swift Threads

2014-08-23 Thread Gerriet M. Denkmann
I searched the Swift book for "thread" and found nothing. A quicksort algorithm works like: quicksort(array) { partition(array) quicksort( left side) quicksort( right side) } On Obj-C I just did: quicksort(array) { partition(array) dispatch_apply( 2, queu

Re: Swift Threads

2014-08-23 Thread Gerriet M. Denkmann
On 24 Aug 2014, at 01:23, Jens Alfke wrote: > >> On Aug 23, 2014, at 12:46 AM, Gerriet M. Denkmann >> wrote: > >> Works fine and is twice as fast. > > That approach is a bit naive, as it's going to spawn a huge number of > [dispatched blocks] (somet

Re: -glyphWithName:

2014-08-24 Thread Gerriet M. Denkmann
On 24 Aug 2014, at 02:00, Holmberg Bertil wrote: > The first part of this method shows how to get the glyph from any character > Works fine with non-Latin characters such as Japanese too Does it also work with aChar starting with the Japanese HIRAGANA LETTER ARCHAIC YE (U+1B001) ? Hint: chars[

Raw Swift

2014-09-18 Thread Gerriet M. Denkmann
This works fine in Xcode 6.0.1: import Cocoa enum ButtonTitle : String { case TitelStop = "Stop" case TitelDone = "Done" } let buttonMode = ButtonTitle.TitelDone let mode = ButtonTitle.toRaw( buttonMode )() But Xcode 6.1 beta 2 says: "error: 'ButtonTitle.Type' does not have

Re: Raw Swift

2014-09-18 Thread Gerriet M. Denkmann
On 19 Sep 2014, at 07:49, Roland King wrote: > >> On 19 Sep 2014, at 8:45 am, Gerriet M. Denkmann wrote: >> >> This works fine in Xcode 6.0.1: >> >> import Cocoa >> >> enum ButtonTitle : String >> { >> case TitelStop

MapKit location authorization

2014-09-19 Thread Gerriet M. Denkmann
My iOS app running on 8.0 says: "Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first." Two questions: 1. where is requestWhenInUseAuthorization

Re: MapKit location authorization

2014-09-19 Thread Gerriet M. Denkmann
On 19 Sep 2014, at 20:21, Roland King wrote: > >> On 19 Sep 2014, at 8:59 pm, Gerriet M. Denkmann wrote: >> >> My iOS app running on 8.0 says: >> "Trying to start MapKit location updates without prompting for location >> author

Re: MapKit location authorization

2014-09-19 Thread Gerriet M. Denkmann
can't handle all this on its own. Very good advice! This was the magic thing I was missing. I'm sure this is clearly documented somewhere (maybe at the local planning department in Alpha Centauri). Anyway, all is well now and thanks very much! Kind regards, Gerriet. > >> >

NSLinguisticTagger

2014-09-23 Thread Gerriet M. Denkmann
I have a problem with NSLinguisticTagger / CFStringTokenizer on iOS 8.0 OS X 10.9.5 (and iOS 7 and earlier) parses "สีเหลือง" quite rightly as two words: "สี" = colour and "เหลือง" = yellow. No dictionary will ever contain "yellow colour". Every dictionary will contain "yellow" and "colour". Th

Re: NSLinguisticTagger

2014-09-23 Thread Gerriet M. Denkmann
On 24 Sep 2014, at 11:46, Roland King wrote: > >> On 24 Sep 2014, at 12:31 pm, Gerriet M. Denkmann >> wrote: >> >> I have a problem with NSLinguisticTagger / CFStringTokenizer on iOS 8.0 >> >> OS X 10.9.5 (and iOS 7 and earlier) parses "ส

Re: NSLinguisticTagger

2014-09-23 Thread Gerriet M. Denkmann
On 24 Sep 2014, at 12:23, Roland King wrote: > >> On 24 Sep 2014, at 1:02 pm, Gerriet M. Denkmann wrote: >> >> >> On 24 Sep 2014, at 11:46, Roland King wrote: >> >>> >>>> On 24 Sep 2014, at 12:31 pm, Gerriet M. Denkmann >>&

Re: NSLinguisticTagger

2014-09-24 Thread Gerriet M. Denkmann
On 24 Sep 2014, at 12:23, Roland King wrote: Seems there are two classes of algorithms: Low class: CFStringTokenizer NSStringEnumerationByWords NSLinguisticTagger These get "我今天还没有去健身房" wrong, and are available on iOS. High class: Icu NSTextView (selectionRangeForProposedRange:granula

Re: NSLinguisticTagger

2014-09-24 Thread Gerriet M. Denkmann
On 24 Sep 2014, at 23:57, 2551 <2551p...@gmail.com> wrote: > That's correct behaviour. There is no such word as เหลือง in Thai. It's a > particle that always exists as an adjunct to something else. Although สี is > a word on its own, เหลือง is not. Even when Thais speakers say something like

Memory Warnings

2014-10-07 Thread Gerriet M. Denkmann
I have an app which sometimes receives: applicationDidReceiveMemoryWarning:. Is there some rule, how much Ram use is ok? Like: not more than x KB, or: not more than y % of total Ram? Is there a way for the app to find out how much memory it is currently using? Is there a way for the app to fin

Re: Memory Warnings

2014-10-08 Thread Gerriet M. Denkmann
On 8 Oct 2014, at 13:42, Quincey Morris wrote: > (reposted after editing for length) > > On Oct 7, 2014, at 22:12 , Gerriet M. Denkmann wrote: > >> Is there a way for the app to find out how much memory it is currently using? > > Here’s my take on this, w

How to pretty print (big)numbers?

2014-10-10 Thread Gerriet M. Denkmann
On iOS 8.0: UInt64 sum = 16494631536958186120UL; NSString *sumString = [ NSNumberFormatter localizedStringFromNumber: @(sum) numberStyle:NSNumberFormatterDecimalStyle

Re: How to pretty print (big)numbers?

2014-10-11 Thread Gerriet M. Denkmann
On 11 Oct 2014, at 13:44, Greg Parker wrote: > >> On Oct 10, 2014, at 11:03 PM, Gerriet M. Denkmann >> wrote: >> >> On iOS 8.0: >> >> UInt64 sum = 16494631536958186120UL; >> NSString *sumString =[ NSNumberFormatter

How to pretty print floating numbers (without loosing precision)?

2014-10-11 Thread Gerriet M. Denkmann
UInt64 sum = 16494631536958187520UL; double doubleSum = sum; NSString *strSum = [ NSNumberFormatter localizedStringFromNumber: @(doubleSum) numberStyle:NS

Re: How to pretty print floating numbers (without loosing precision)?

2014-10-11 Thread Gerriet M. Denkmann
On 11 Oct 2014, at 20:47, Scott Ribe wrote: > On Oct 11, 2014, at 7:36 AM, Scott Ribe wrote: > >> On Oct 11, 2014, at 2:04 AM, Gerriet M. Denkmann >> wrote: >> >>> Note: converting to double does NOT loose any digits. >> >> Well, it has to. N

DOMDocument in 10.10

2014-10-18 Thread Gerriet M. Denkmann
WebFrame *mainFrame = [ webView mainFrame ]; DOMDocument *domDoc = [ mainFrame DOMDocument ]; When I print domDoc, I get with 10.9 something like: with 1 children with 3 children [ 0] with 15 children [ 0] DOMText = "** white **"

Re: DOMDocument in 10.10

2014-10-18 Thread Gerriet M. Denkmann
> On 19 Oct 2014, at 00:52, Jens Alfke wrote: > > >> On Oct 18, 2014, at 5:33 AM, Gerriet M. Denkmann >> wrote: >> >> Note: the head has only 12 children (the first 10 are identical to 10.9), >> and there is no body at all. > > Weird! Are you s

NSInvocation crashes in AutoreleasePool

2014-10-21 Thread Gerriet M. Denkmann
10.10, Xcode 6.1, using Arc. The following code works fine, with USE_INVOCATION defined or not: #define USE_INVOCATION (or commented out) - (NSSet *)doSomethingWith: (NSArray *)listOfActions onSet: (NSSet *)originSet { NSSet *inputSet = originSet; for( NSString *curSel

Return values of NSAlert

2014-10-21 Thread Gerriet M. Denkmann
NSAlert has: - (void)beginSheetModalForWindow:(NSWindow *)sheetWindow completionHandler:(void (^)(NSModalResponse returnCode))handler NSModalResponse has three values: Stop, Abort, Continue - none of which bear any resemblance with the buttons: Default, Alternate, Other in my NSAle

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 22 Oct 2014, at 03:17, Greg Parker wrote: > > >> On Oct 21, 2014, at 2:44 AM, Gerriet M. Denkmann >> wrote: >> >> 10.10, Xcode 6.1, using Arc. >> >> The following code works fine, with USE_INVOCATION defined or not: > > [...] >

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 01:02, Scott Ribe wrote: > > On Oct 22, 2014, at 11:46 AM, Gerriet M. Denkmann > wrote: >> >> But how to fix this? > > ARC expects a retained pointer; I'd retain it. I tried, but got told: "error: ARC forbids explicit messag

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 01:37, Scott Ribe wrote: > > On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell > wrote: >> >> Surely the code that returns the object pointed to by temp has to ensure >> that the object has been correctly retained? > > So, maybe __autorelease? Tried: [ iv invoke ]; NSDic

Re: NSInvocation crashes in AutoreleasePool

2014-10-22 Thread Gerriet M. Denkmann
> On 23 Oct 2014, at 04:31, Greg Parker wrote: > > >> On Oct 22, 2014, at 12:04 PM, Gerriet M. Denkmann >> wrote: >> >>> On 23 Oct 2014, at 01:37, Scott Ribe wrote: >>> >>> On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell >>

pacemaker in 10.10

2014-10-22 Thread Gerriet M. Denkmann
In 10.9 there was this nice pacemaker daemon (keeping the clock in sync). In 10.10: /private/var/db/ntp.drift exists and has a plausible value: -rw-r--r--@ 1 root wheel 8 21 Oct 17:29 /private/var/db/ntp.drift cat /private/var/db/ntp.drift -26.396 -rwxr-xr-x 1 root wheel 24720 10 Sep 06:27

terminationHandler of NSTask delayed

2014-11-01 Thread Gerriet M. Denkmann
App with NSTimer, which periodically starts an NSTask, which has a terminationHandler. Sometimes (no idea how to trigger this) the terminationHandlers do NOT get executed when the task terminates. Only when I make my app active, a whole bunch of them will - but not in the correct order. Is thi

Auto layout without ambiguity

2014-11-01 Thread Gerriet M. Denkmann
10.10 From left to right: fixed distance from super view Label fixed distance TextField (this should be ≥ something, otherwise fitting to content) fixed distance Label variable distance (≥ some minimum) Button fixed distance to super view When I set the width of TextField to ≥ something, Xcode

Re: Auto layout without ambiguity

2014-11-01 Thread Gerriet M. Denkmann
> On 2 Nov 2014, at 00:41, Marco S Hyman wrote: > > On Nov 1, 2014, at 9:17 AM, Gerriet M. Denkmann wrote: >> >> TextField (this should be ≥ something, otherwise fitting to content) >> ... >> variable distance (≥ some minimum) > > Are they the same

Re: Auto layout without ambiguity

2014-11-01 Thread Gerriet M. Denkmann
> On 2 Nov 2014, at 09:01, Roland King wrote: > > >> On 2 Nov 2014, at 12:17 am, Gerriet M. Denkmann wrote: >> >> 10.10 >> >> From left to right: >> >> fixed distance from super view >> Label >> fixed distance >>

dispatch_source does not work

2014-11-04 Thread Gerriet M. Denkmann
I want to monitor a file for changed content. Polling is generally not a good idea, so I tried dispatch_source. But it does not work. Here the code: static NSString *const kTestPath= @"/tmp/a.test"; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

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