Slow Keyboard in iOS 9.0

2015-09-19 Thread Gerriet M. Denkmann
Master-Detail app for iPhone Master has a TableView with words and a SearchField. DetailView has info about selected word. Hitting the Back-Button in the DetailView shows the MasterView and then (after what feels like a second) the Keyboard slides up. This is not what I want. Before iOS 9.0 the

Unsigned Modulo

2015-08-12 Thread Gerriet M. Denkmann
OS X 10.10.4, Xcode 7 beta 3 This code produces some (for me) unexpected results: NSUInteger unsignedSize = 3; NSInteger signedSize = 3; for ( NSInteger rawValue = -6; rawValue < 5; rawValue++ ) { NSInteger modValueU = rawValue; NSInteger modValueS = rawValue; modValueU %

How to zoom with auto layout?

2015-07-29 Thread Gerriet M. Denkmann
10.10.4 I want to zoom (width only) my NSView and want the mid-point of the view to be still in the mid after zooming. The following code works - but only if zooming slowly. How can one avoid the performSelector:afterDelay ? Is there some notification like NSLayoutHasBeenDoneNotification ? I tri

Re: How to get Unicode's "General Category" of a character?

2015-07-07 Thread Gerriet M. Denkmann
. Do I have to download the source from ICU? Kind regards, Gerriet. > > >> On Jul 7, 2015, at 8:03 AM, Gerriet M. Denkmann wrote: >> >> Given a character (a Unicode code point, to be exact) like U+FF0B (FULLWIDTH >> PLUS SIGN), I want to know the General Category

How to get Unicode's "General Category" of a character?

2015-07-07 Thread Gerriet M. Denkmann
Given a character (a Unicode code point, to be exact) like U+FF0B (FULLWIDTH PLUS SIGN), I want to know the General Category of this. For this example it would be “Sm" (aka. Math_Symbol or Symbol, Math). I could download the current version of UnicodeData.txt and parse it. But this looks not very

Why is a comma considered unsafe?

2015-06-24 Thread Gerriet M. Denkmann
When I create a new TextEdit document, add a “-“ (aka. HYPHEN-MINUS), select this “-“ and then move the cursor inside the window I will see in Console.app 10 lines like: 24/06/2015 21:44:17.319 Han Radicals[20349]: _NSExtensionIsSafeExpressionForObjectWithSubquerySubstitutions: Expression cons

10.10 replacement for SMJobCopyDictionary

2015-05-25 Thread Gerriet M. Denkmann
How to translate this into 10.10 without deprecation warnings? CFDictionaryRef diref = SMJobCopyDictionary( kSMDomainSystemLaunchd, “de.mdenkmann.MyTool” ); if ( diref == nil ) // MyTool is not running Gerriet. ___ Cocoa-dev mailing list (

Invalid amor - what does this mean?

2015-05-22 Thread Gerriet M. Denkmann
Using the STKaiti-SC-Black font (display name: Kaiti SC Black) (in TextEdit, Font Book, or whatever) I get lines like this: [some app] CoreText: Invalid ‘amor’ Subtable In name = STKaiti-SC-Black, size = 36.00, matrix = 0x0, descriptor = {attributes = {type = mutable dict, count = 1, entrie

Re: The Case of the Dancing Keyboard

2015-04-27 Thread Gerriet M. Denkmann
normal. Sorry for the noise. Gerriet. > On Apr 27, 2015, at 2:04 AM, Gerriet M. Denkmann wrote: > >> >>> On 23 Apr 2015, at 12:04, Gerriet M. Denkmann wrote: >>> >>> >>> An UITableViewController with an UISearchController in iOS 8.3 >

Re: The Case of the Dancing Keyboard

2015-04-26 Thread Gerriet M. Denkmann
> On 23 Apr 2015, at 12:04, Gerriet M. Denkmann wrote: > > > An UITableViewController with an UISearchController in iOS 8.3 > > When I click in the SearchBar the following dance happens: > Keyboard comes; > Keyboard goes away; > Background becomes gray; > Keyb

The Case of the Dancing Keyboard

2015-04-22 Thread Gerriet M. Denkmann
An UITableViewController with an UISearchController in iOS 8.3 When I click in the SearchBar the following dance happens: Keyboard comes; Keyboard goes away; Background becomes gray; Keyboard comes again and now stays. This is sort of difficult to see in the Simulator because it happens too

Re: How to remove Keyboard when UITableView gets scrolled

2015-04-18 Thread Gerriet M. Denkmann
> On 18 Apr 2015, at 21:07, Michael Babin wrote: > >> On Apr 18, 2015, at 5:32 AM, Gerriet M. Denkmann >> wrote: >> >> Anyway: how can I detect that the table did start scrolling? >> Using a timer to periodically check the index of the top row seems

How to remove Keyboard when UITableView gets scrolled

2015-04-18 Thread Gerriet M. Denkmann
I have a UITableView with a UISearchController. One types into the search field and the table is filled with appropriate entries. But only a small part of the table is visible, the rest is obscured by the keyboard. When one stops typing and starts scrolling the table it would be nice if the ke

Re: Master - Detail: How to get back?

2015-04-16 Thread Gerriet M. Denkmann
> On 16 Apr 2015, at 21:42, Kyle Sluder wrote: > > On Apr 15, 2015, at 10:49 PM, Gerriet M. Denkmann > wrote: >> >> >> >> >> 3.Run >> >> Run on iPhone: >> Back Button is called "Master" >> >> Run on i

Re: Master - Detail: How to get back?

2015-04-16 Thread Gerriet M. Denkmann
> On 16 Apr 2015, at 13:41, Roland King wrote: > > >> >> 5. Run >> >> iPhone - tapping on "Do & Back" prints: >> 2015-04-16 12:16:52.799 Dummi[28069:20737983] -[MasterViewController >> doSomethingAndBackToMaster:] did something with "2015-04-16 05:16:49 +", >> will do: [ perform]

Re: Master - Detail: How to get back?

2015-04-15 Thread Gerriet M. Denkmann
>> Can this be done? Or is there a better way to make my button work both >> for iPhone and iPad? > > Well, my first question is: can you just put your work in the > implementation of the unwind selector? That is the way the work is done. > The unwind itself will be a no-op > if the split view

Re: Master - Detail: How to get back?

2015-04-15 Thread Gerriet M. Denkmann
While my iPhone can use the “DoSomethingAndGoBackToMasterView” button fine, the same button does nothing for iPad. Of course iPad does not need an unwinding segue - both master and detail view are always visible (at least in landscape orientation). But the “DoSomething” part is still needed. C

Re: How to remove iPad popover?

2015-04-15 Thread Gerriet M. Denkmann
> > > On Tue, Apr 14, 2015, at 11:49 PM, Gerriet M. Denkmann wrote: >> And if there is any way (easy or not) to get this (in a non-deprecated >> way), I would be very interested to hear about it. > > There is not. Please file a Radar. I filed two: 20549495 Unabl

Re: Master - Detail: How to get back?

2015-04-15 Thread Gerriet M. Denkmann
> On 15 Apr 2015, at 15:37, Quincey Morris > wrote: > > On Apr 15, 2015, at 01:18 , Gerriet M. Denkmann wrote: >> >> In DetailViewController I added: >> >> - (IBAction)unwindToMainMenu:(UIStoryboardSegue*)sender > > I dunno offhand, but you origi

Re: Master - Detail: How to get back?

2015-04-15 Thread Gerriet M. Denkmann
> On 15 Apr 2015, at 14:51, Quincey Morris > wrote: > > On Apr 14, 2015, at 23:47 , Gerriet M. Denkmann wrote: >> >> Using the Xcode template: iOS - Master-Detail, the Detail view has (in the >> top left corner) a Back-Button, which works fine. >> &g

Master - Detail: How to get back?

2015-04-14 Thread Gerriet M. Denkmann
Using the Xcode template: iOS - Master-Detail, the Detail view has (in the top left corner) a Back-Button, which works fine. Now I added another UIBarButtonItem called: “Do something and go back” connected to some IBAction in DetailViewController. But how to make it go back to the MasterView?

Re: How to remove iPad popover?

2015-04-14 Thread Gerriet M. Denkmann
Controller property. But then: how to get the UIStoryboardPopoverSegue ? Kind regards, Gerriet. > > Cheers, > Dave > >> On Apr 14, 2015, at 10:13 PM, Gerriet M. Denkmann >> wrote: >> >> >>> On 15 Apr 2015, at 08:59, Roland King wrote: >>> >>> >

Re: How to remove iPad popover?

2015-04-14 Thread Gerriet M. Denkmann
> On 15 Apr 2015, at 08:59, Roland King wrote: > > >> On 15 Apr 2015, at 09:49, Gerriet M. Denkmann wrote: >> >> On iPad (portrait orientation) there is on the left a MasterView, >> overlapping the DetailView. >>

How to remove iPad popover?

2015-04-14 Thread Gerriet M. Denkmann
On iPad (portrait orientation) there is on the left a MasterView, overlapping the DetailView. (i.e. splitViewController.displayMode = UISplitViewControllerDisplayModePrimaryOverlay) When I tap on the DetailView, the MasterView slides away. (i.e. splitViewController.displayMode → UISplitViewCont

Re: My Phone does not work upside down

2015-04-14 Thread Gerriet M. Denkmann
> On 14 Apr 2015, at 22:00, Roland King wrote: > > >> On 14 Apr 2015, at 22:35, Gerriet M. Denkmann wrote: >> >> >>> On 14 Apr 2015, at 21:21, Jens Alfke wrote: >>> >>> >>>> On Apr 14, 2015, at 4:57 AM, Roland King wrote:

Re: My Phone does not work upside down

2015-04-14 Thread Gerriet M. Denkmann
tion. > > > > > On Apr 14, 2015, at 10:44 AM, Gerriet M. Denkmann wrote: > >> >>> On 14 Apr 2015, at 21:40, Alex Zavatone wrote: >>> >>> So, just to be clear, when you click on your Target iOS app and select >>> General in the main

Re: My Phone does not work upside down

2015-04-14 Thread Gerriet M. Denkmann
ne that > says Upside Down? > Only the first two: Portrait and Upside Down. > > > On Apr 14, 2015, at 10:35 AM, Gerriet M. Denkmann wrote: > >> >>> On 14 Apr 2015, at 21:21, Jens Alfke wrote: >>> >>> >>>> On Apr 14, 2015, at 4:5

Re: My Phone does not work upside down

2015-04-14 Thread Gerriet M. Denkmann
> On 14 Apr 2015, at 21:21, Jens Alfke wrote: > > >> On Apr 14, 2015, at 4:57 AM, Roland King wrote: >> >> Read the manual. Excellent advice. I have been following this since hours. As to supportedInterfaceOrientations: All my subclasses of UIViewController have this implemented - none get

My Phone does not work upside down

2015-04-14 Thread Gerriet M. Denkmann
I created a new project, iOS, Master-Detail and edited Info.plist: Supported interface orientations = Portrait (bottom home button) and Portrait (top home button). Supported interface orientations (iPad) contains all 4 orientations (unchanged) Run on iPad → as expected But run on iPhone, only

UISearchResultsUpdating

2015-04-14 Thread Gerriet M. Denkmann
Using UISearchController with an UISearchBar with 3 scope buttons (xCode 6.3, iOS 8.3) I never get notified when the scope changes. The documentation about updateSearchResultsForSearchController in UISearchResultsUpdating says: “This method is automatically called whenever the search bar becom

Where is kUCHighSurrogateRangeStart in Swift 1.2

2015-04-09 Thread Gerriet M. Denkmann
Using Xcode 6.2 my Swift program compiled and run fine. Now Xcode 6.3 complains of unresolved identifier kUCHighSurrogateRangeStart. This is defined in: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/Headers/TextCommon.h . How to make S

Re: Where is my bicycle?

2015-04-07 Thread Gerriet M. Denkmann
> On 7 Apr 2015, at 00:15, Quincey Morris > wrote: > > On Apr 6, 2015, at 09:19 , Gerriet M. Denkmann wrote: > > A suggestion, though: > > Try building your character set using ‘characterSetWithRange:’ and/or the > NSMutableCharacterSet methods that add ranges,

Re: Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
> On 7 Apr 2015, at 05:44, Greg Parker wrote: > > >> On Apr 6, 2015, at 11:15 AM, Gerriet M. Denkmann >> wrote: >> >> 2. characterSetWithCharactersInString seems to take only the lower 16 bits >> of the code points in the string. Bug. >> Wor

Re: Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
> On 7 Apr 2015, at 03:42, Quincey Morris > wrote: > > On Apr 6, 2015, at 12:29 , Greg Parker wrote: >> >> my understanding is that when Cocoa says "character" it usually means >> "UTF-16 code unit". @"🚲".length == 2, for example. Cocoa's string API >> designed when Unicode was still a true

Re: Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
> On 7 Apr 2015, at 00:15, Quincey Morris > wrote: > > On Apr 6, 2015, at 09:19 , Gerriet M. Denkmann wrote: >> >> Where is my bicycle gone? What am I doing wrong? > > Before this thread heads further into outer space… > > I suspect it [NSCharacte

Re: Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
> On 6 Apr 2015, at 23:52, Steve Mills wrote: > > On Apr 6, 2015, at 11:45:52, Gerriet M. Denkmann wrote: >> >>> >>>>NSString *string = @"abc 🚲 xyz";// BICYCLE = U+1F6B2 >>> >> >> If this is so: why did my co

Re: Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
> On 6 Apr 2015, at 23:36, Charles Srstka wrote: > >> >> On Apr 6, 2015, at 11:19 AM, Gerriet M. Denkmann >> wrote: >> >> OS X 10.10.2 >> >> NSString *string = @"abc 🚲 xyz";// BICYCLE =

Where is my bicycle?

2015-04-06 Thread Gerriet M. Denkmann
OS X 10.10.2 NSString *string = @"abc 🚲 xyz";// BICYCLE = U+1F6B2 NSCharacterSet *charSet = [ NSCharacterSet characterSetWithCharactersInString: string ]; BOOL pq = [ charSet longCharacterIsMember: 0x1F6B2 ]; NSLog(@"%s CharacterSet from \"%@\" contains %s🚲

Re: Where are my bytes?

2015-04-04 Thread Gerriet M. Denkmann
> On 4 Apr 2015, at 17:21, Ken Thomases wrote: > > On Apr 4, 2015, at 4:23 AM, Gerriet M. Denkmann wrote: > >> When I look at " /Library/Dictionaries/Apple >> Dictionary.dictionary/Contents/Info.plist" in Finder, it shows a preview and >> says 5 kB.

Re: Where are my bytes?

2015-04-04 Thread Gerriet M. Denkmann
; Gerriet. > Michael David Crawford, Consulting Software Engineer > mdcrawf...@gmail.com > http://www.warplife.com/mdc/ > > Available for Software Development in the Portland, Oregon Metropolitan > Area. > > > On Sat, Apr 4, 2015 at 2:23 AM, Gerriet M. D

Where are my bytes?

2015-04-04 Thread Gerriet M. Denkmann
When I look at " /Library/Dictionaries/Apple Dictionary.dictionary/Contents/Info.plist" in Finder, it shows a preview and says 5 kB. Ok. But: Finder → FIle → Get Info says: 4,893 bytes (Zero bytes on disk) And lstat shows: st_size = 4893 (file size, in bytes) st_blocks = 0 (

AutoLayout

2014-12-24 Thread Gerriet M. Denkmann
OS X 10.10.1; Xcode Version 6.1.1 (6A2008a) A window has: Content View → NSSplitView top split NSView → NSBox → 2 NSTextFields + NSScrollView → NSClipView → NSTableView bottom NSView → NSBox → NSScrollView → NSClipView → NSTextView Xcode shows no warnings. App works fine, but the firs

How to make a TableColumn unsortable

2014-12-17 Thread Gerriet M. Denkmann
I tried: myTableColumn.sortDescriptorPrototype = nil; But clicking in the Header still sorts it. What am I missing? Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. C

Re: Observing changes in Table

2014-12-17 Thread Gerriet M. Denkmann
> On 17 Dec 2014, at 18:32, Jerry Krinock wrote: > > >> On 2014 Dec 17, at 02:02, Gerriet M. Denkmann wrote: >> >> A TableView with an ArrayController which has an Array of >> MutableDictionaries; keys corresponding to TableColumns. >> The table is ed

Observing changes in Table

2014-12-17 Thread Gerriet M. Denkmann
A TableView with an ArrayController which has an Array of MutableDictionaries; keys corresponding to TableColumns. The table is editable and the dictionary of the edited row gets changed. All as expected. But I want to know when any value of any row has been changed by the user, in order to upd

Open Recent Crash

2014-12-13 Thread Gerriet M. Denkmann
Whenever I do in TextEdit: File → Open Recent I get a crash. Obviously the list of recent documents is somehow corrupted. So I renamed "~/Library/Preferences/com.apple.TextEdit.LSSharedFileList.plist" to: "LSSharedFileList bad.plist", started TextEdit and got the same crash. Also got a new "LSSh

Re: when has AutoLayout finished its work?

2014-11-26 Thread Gerriet M. Denkmann
> > >> Finally I settled with: >> >> - (void)windowDidLoad >> { >> [super windowDidLoad]; >> [ self performSelector: @selector(updateFrame:) withObject: @(0) >> afterDelay: 1 ]; >> } >> >> This has the (small) disadvantage that the window initially shows a boring >> grey cu

Re: when has AutoLayout finished its work?

2014-11-26 Thread Gerriet M. Denkmann
> On 26 Nov 2014, at 13:15, Ken Thomases wrote: > > On Nov 25, 2014, at 11:50 PM, Gerriet M. Denkmann > wrote: > >> Document based Cocoa app; Window has CustomView inside ScrollView; uses >> autolayout. 10.10.1 >> >> Problem: the autolayout stuff kee

Re: when has AutoLayout finished its work?

2014-11-25 Thread Gerriet M. Denkmann
> On 26 Nov 2014, at 13:15, Ken Thomases wrote: > > On Nov 25, 2014, at 11:50 PM, Gerriet M. Denkmann > wrote: > >> Document based Cocoa app; Window has CustomView inside ScrollView; uses >> autolayout. 10.10.1 >> >> Problem: the autolayout stuff kee

when has AutoLayout finished its work?

2014-11-25 Thread Gerriet M. Denkmann
Document based Cocoa app; Window has CustomView inside ScrollView; uses autolayout. 10.10.1 Problem: the autolayout stuff keeps butting in and setting the frameSize of my CustomView to (0,0). So I need some method like: autolayoutHasFinishedItsWork, but cannot find such. windowDidLoad of DaysW

Re: dispatch_source does not work

2014-11-05 Thread Gerriet M. Denkmann
t; ___ Peter Hartmann > > mailto:hphartm...@justmail.de > > > Am 05.11.2014 um 07:50 schrieb 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

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 {

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 >>

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

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

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

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

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 >>

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 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 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: > > [...] >

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

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

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

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: 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

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 (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 (big)numbers?

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

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

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: 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

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-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-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 "ส

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: 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. > >> >

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

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: 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

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: -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[

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

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: memmove in Swift

2014-08-21 Thread Gerriet M. Denkmann
On 21 Aug 2014, at 22:28, Roland King wrote: > >> >> The default release ones: ObjC: Fastest, Smallest and Swift: Fastest. > > Isn't there an 'unchecked' option somewhere, or is that still aliased to > Fastest? > Swift has an Unchecked option, which is still about 25 % slower than Obj-C.

Re: memmove in Swift

2014-08-21 Thread Gerriet M. Denkmann
On 21 Aug 2014, at 16:55, Roland King wrote: > >> My test (using [UInt32] for both Swift and ObjC) showed: > > What is [UInt32] for ObjC? A C-array of uint32_t? Well, the OBj-C sort gets a Swift array and treats it as as a C-array of UInt32. Same as the Swift version. >> 2. the build-in S

Re: memmove in Swift

2014-08-20 Thread Gerriet M. Denkmann
On 21 Aug 2014, at 11:53, Marco S Hyman wrote: > On Aug 20, 2014, at 8:32 PM, Gerriet M. Denkmann wrote: > >> But I thought that maybe memmove might be more efficient: > > Optimizing already? Not really. More like learning. Actually I was checking the results of Je

Re: memmove in Swift

2014-08-20 Thread Gerriet M. Denkmann
On 21 Aug 2014, at 11:25, Quincey Morris wrote: > On Aug 20, 2014, at 20:32 , Gerriet M. Denkmann wrote: > >> But I thought that maybe memmove might be more efficient: >> >> let dest : UnsafeMutablePointer = arr + lowerIndex + 1 > > Er, no. There are m

memmove in Swift

2014-08-20 Thread Gerriet M. Denkmann
This works: private func shiftArray( inout arr: [UInt32], lowerIndex: UInt, upperIndex: UInt ) { // move: arr[ lowerIndex ..< upperIndex ] to: arr[ lowerIndex + 1 ... upperIndex ] let av = arr[ Int(upperIndex) ] for v

Re: How to convert String.Index to UInt?

2014-08-19 Thread Gerriet M. Denkmann
On 18 Aug 2014, at 12:44, Quincey Morris wrote: > On Aug 17, 2014, at 21:36 , Gerriet M. Denkmann wrote: > > Watching (so to speak) what you’re doing from a distance, what concerns me is > *not* that you are or are not doing things in a swifty way, but that you’re > *evaluat

Re: How to convert String.Index to UInt?

2014-08-17 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 18:43, Roland King wrote: > I was asking more about actually using the language to write applications, > real ones, not just examples in a book but real apps which have to interface > with the runtime we use, Cocoa. Do you find you are really using the full > power of Swift

Class in Swift

2014-08-16 Thread Gerriet M. Denkmann
How to translate into Swift: - (void)myFunctionWithClass: (Class)someClass { for(...) { p = ... if ( p is not special ) continue; id aClass = [[ someClass alloc] initWithParameter: p ]; ... do something with aClass

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 16:25, Stephen J. Butler wrote: > Try: > > import Cocoa > > let s = "hallo\there" > let aas = NSMutableAttributedString(string: s, attributes: nil) > > if let rangeOfTab = s.rangeOfString( "\t" ) { > let colour = NSColor.grayColor() > let length = distance(s.startIn

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
On 16 Aug 2014, at 16:04, Roland King wrote: > You can’t. > > let s : NSString = "hallo\there" > let aas = NSMutableAttributedString( string: s, attributes: nil > ) > > let rangeOfTab = s.rangeOfString( "\t" ) > if rangeOfTab.location

Re: How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
gt; Maybe read more: > > http://oleb.net/blog/2014/07/swift-strings/ Very useful text. Thanks for the link! > On Sat, Aug 16, 2014 at 3:30 AM, Gerriet M. Denkmann > wrote: > import Cocoa > > let s = "hallo\there" > let aas = NSMutableAttributedStr

How to convert String.Index to UInt?

2014-08-16 Thread Gerriet M. Denkmann
import Cocoa let s = "hallo\there" let aas = NSMutableAttributedString( string: s, attributes: nil ) let rangeOfTab = s.rangeOfString( "\t" ) if rangeOfTab != nil { let colour = NSColor.grayColor() let locationOfTab = rangeOfTab!.startIndex let aRan

Re: Stuck in Swift

2014-08-15 Thread Gerriet M. Denkmann
On 14 Aug 2014, at 19:24, Roland King wrote: >> >> class AppDelegate: NSObject >> { >> dynamic var statusString : String? // bound to some TextField >> >> let someThing = SomeClass( myStatusHandler )< this >> creates strange error messages >> >> func

Re: Translating to Swift

2014-08-14 Thread Gerriet M. Denkmann
On 15 Aug 2014, at 02:50, Quincey Morris wrote: > On Aug 14, 2014, at 11:44 , Gerriet M. Denkmann wrote: > >> But: is this thread-safe? What if several threads are trying to use the >> sharedThing? > > Jean-Daniel is teasing you slightly. It *is* thread-safe. For th

Re: Translating to Swift

2014-08-14 Thread Gerriet M. Denkmann
thread". Kind regards, Gerriet. > Le 13 août 2014 à 12:30, Gerriet M. Denkmann a écrit : > >> >> How could I translate this to Swift? >> >> + (Thing *)sharedThing >> { >> static Thing *commonThing; >>

Re: Stuck in Swift

2014-08-14 Thread Gerriet M. Denkmann
On 14 Aug 2014, at 14:45, Muhammad Hussein Nasrollahpour wrote: > The problem is with your calling convention in specified line. Notice that > when you call a method which is part of a class you should write the > parameter name and then value. Ok. You are right. > class AppDelegate: NSObj

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