Re: Swift function overloading - invoking func with specific parameter (in place of Any parameter) on passing Any object

2019-10-28 Thread Andrew Thompson via Cocoa-dev
ther than the model class, hence > I want to avoid that path. > >> On Sun, Oct 27, 2019 at 7:55 PM Andrew Thompson wrote: >> >> > Is there any other elegant way to achieve the desired behavior without >> > using `if-let + typecasting`? >> >>

Re: Swift function overloading - invoking func with specific parameter (in place of Any parameter) on passing Any object

2019-10-27 Thread Andrew Thompson via Cocoa-dev
> Is there any other elegant way to achieve the desired behavior without > using `if-let + typecasting`? One way is to use classes instead on structs and define display as a method on those classes. I’m no Swift expert but I expect you may find value in making display() into a protocol.

Re: Times in other cities

2017-05-15 Thread Andrew Thompson
. Andrew. > On May 15, 2017, at 9:17 AM, Eric E. Dolecki <edole...@gmail.com> wrote: > > Europe/London = BST though, correct? > > > > > >> On Mon, May 15, 2017 at 9:06 AM Andrew Thompson <lordpi...@mac.com> wrote: >> >> >> > O

Re: Times in other cities

2017-05-15 Thread Andrew Thompson
> On May 15, 2017, at 8:50 AM, Eric E. Dolecki wrote: > > Thanks for your reply. Does this look safe to use? > > // London > let locale = TimeZone.init(abbreviation: "BST") > Use "Europe/London": 1. BST has at least 3 different meanings 2. You'll automatically get

Re: Direct NSSpeechSynthesizer output to buffer instead of file?

2014-02-06 Thread Andrew Thompson
If you post to the speech-dev list you'll likely get a more detailed reply as Apple's TTS engineers hang out there. I believe it is possible to hook up the synthesizer as an Audio Unit and capture the output that way. A more basic approach would be to use the venerable UNIX mkfifo function

Re: New busy cursor in the Finder

2012-12-20 Thread Andrew Thompson
I have TextWrangler installed but not BBedit. In any case this was definitely showing up in the Finder, though given it was the Open With menu item u guess it could be Launch Services showing it. On Dec 19, 2012, at 11:55 PM, John Pannell j...@positivespinmedia.com wrote: I noticed the

Re: Private Method?

2011-11-09 Thread Andrew Thompson
Java, running with a byte code verifier and a strict security manager enabled does a reasonably through job of enforcing private methods at runtime. You can defeat it, but not typically with remotely loaded code such as applets. It's a continuum of design choices in languages. You're right

Re: CFURLWriteDataAndPropertiesToResource as root?

2011-08-08 Thread Andrew Thompson
But doesn't it seem entirely reasonable that apps signed by the same vendor (for example) be able to share files? I mean in a safe location perhaps with a limited quota of space? Cookies and client side storage in HTML 5 allow this (not exactly the same but still), but native apps have no

Re: Application Design

2011-06-01 Thread Andrew Thompson
I'll caution you as written that singleton is not be thread safe. Often you don't care, because you only have one thread or because creating 2 webservice clients may not be a problem for you. On Jun 1, 2011, at 3:54 AM, Dan Hopwood d...@biasdevelopment.com wrote: Thanks Steve. For

Re: encoding of file names

2011-05-26 Thread Andrew Thompson
However, in practical terms, the indexable string elements are components, not codepoints. It seems to me the single hardest thing to come to grips with when newly approaching NSString is understanding that 'unichar's (and characters in the sense of [characterAtIndex:]) *aren't*

Re: How to detect string encoding before reading a file in NSString?

2011-04-26 Thread Andrew Thompson
Another battle tested piece of code would be Mozilla's sniffer, if external libraries and it's license suit you. This document is out of date, bur explains the ideas. http://www.mozilla.org/projects/intl/detectorsrc.html On Apr 26, 2011, at 3:39 PM, John Pannell j...@positivespinmedia.com

Re: NSXML and invalid UTF8 characters

2010-01-31 Thread Andrew Thompson
I'm a little surprised that no one else mentioned it, but are you sure that you actually want to strip the characters? As Sixten Otto said For what it's worth, another common cause of problems with stuff pasted from Word (at least on the web), is Word docs that contain characters from the

Crash in +[NSMethodSignature signatureWithObjCTypes:]

2009-09-28 Thread Andrew Thompson
It seems when I push signatureWithObjCTypes: hard - i.e. submitting about 250 tasks into NSOperationQueue, signatureWithObjCTypes will occasionally crash. By occasionally, I mean about 1 time in 10 to about 1 time in 15 on a dual core machine: Thread 68 Crashed: Dispatch queue:

Re: Time Zone Names

2009-03-11 Thread Andrew Thompson
These are called Olsen names. One typically uses a city style. e.g. America/New_York, Europe/London. Which is a bit arbitrary but captures the DST thing well. In theory, the timezone ET captures EST and EDT but the 2 letter names are even more ambiguous than the 3 letter names, and I am

Re: What alternatives exist for objc_setClassHandler?

2009-01-31 Thread Andrew Thompson
, Michael Ash wrote: On Sat, Jan 31, 2009 at 3:36 PM, Andrew Thompson lordpi...@mac.com wrote: Hi all, I was looking for a way to define Objective-C classes at runtime... specifically to be able to supply class definitions when a Nib file is loaded. This search soon led me to objc_setClassHandler

What alternatives exist for objc_setClassHandler?

2009-01-31 Thread Andrew Thompson
Hi all, I was looking for a way to define Objective-C classes at runtime... specifically to be able to supply class definitions when a Nib file is loaded. This search soon led me to objc_setClassHandler, but that's listed as deprecated without replacement here:

Re: Inverse Regex Library?

2008-07-17 Thread Andrew Thompson
Your question is a simple problem, actually, that hides a hard problem. Creating a regex from a bunch of strings is simple, just take all the words and OR them together, so in your example: Word1 | Word2 | Word5 | Word8 | Word11 | Word19 | Word23 | Word45 | Word77 Unfortunately, there is no

Blue lines

2008-07-15 Thread Andrew Thompson
How do Interface Builder and Quartz Composer draw the blue line connections from object to object? I have been looking through the APIs, but I can't find anything that looks right. I thought of just drawing my own line on a custom view (shouldn't be that hard), but interface builder manages to do