Re: Cocoa framework or Object class to uncompress files

2022-10-25 Thread Carl Hoefs via Cocoa-dev
On Oct 25, 2022, at 12:12 AM, Markus Spoettl  wrote:
> 
> On 10/25/22 3:45 AM, Carl Hoefs via Cocoa-dev wrote:
>> My iOS app downloads a gzip'd data file into its sandbox that the app needs 
>> to unzip
>> and process. I don't see anything in Cocoa (such as NSFileManager) that 
>> addresses
>> uncompressing files. Is there a way?
>> (BTW, I tried some ancient 3rd party code called ZipArchive but it always 
>> fails trying
>> to parse the zipped file.)
>> I'm hoping there's a built-in solution or framework that I'm just 
>> overlooking.
> 
> I'm using an NSData extension that uses :
> 
> https://github.com/schacon/igithub/blob/master/CocoaGit/Util/NSData%2BCompression.m
> 
> Is very easy to use and works very well. You need to add "-lz" to the "Other 
> Linker Flags" linker option in the target build settings of your project.
> 
Wow, that works perfectly! And it handles both ZIP and GZIP! 
It's also efficient: It inflates a 120MB file in 0.28 secs. Awesome!

(BTW, I added "libz.tbd" to the project, and it works. But what is with the 
.tbd extension?)

Thanks so much for this, I was about to give up hope!

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Cocoa framework or Object class to uncompress files

2022-10-24 Thread Carl Hoefs via Cocoa-dev
My iOS app downloads a gzip'd data file into its sandbox that the app needs to 
unzip and process. I don't see anything in Cocoa (such as NSFileManager) that 
addresses uncompressing files. Is there a way?

(BTW, I tried some ancient 3rd party code called ZipArchive but it always fails 
trying to parse the zipped file.) 

I'm hoping there's a built-in solution or framework that I'm just overlooking.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIActivityIndicatorView to send an action

2022-10-14 Thread Carl Hoefs via Cocoa-dev
Ah yes! I just used UITapGestureRecognizer and voila! It's working! Much 
cleaner this way.
Thanks!

-Carl


> On Oct 14, 2022, at 1:45 PM, Richard Somers  wrote:
> 
> Why not use a gesture recognizer with the UIActivityIndicatorView to send an 
> action to a target object?
> 
> Richard
> 
> 
>> On Oct 14, 2022, at 1:37 PM, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> The idea just occurred to me to place a clear UIButton atop the spinner and 
>> have that send the action. That will work but just seems kinda hacky...
>> 
>>> On Oct 14, 2022, at 12:30 PM, Carl Hoefs via Cocoa-dev 
>>>  wrote:
>>> 
>>> Got an iPhone app enhancement request today to be able to tap the spinning 
>>> activity indicator (UIActivityIndicatorView) to pop up some info on the 
>>> status of the busy activity. 
>>> 
>>> UIActivityIndicatorView isn't like a UIButton which has sent actions, so is 
>>> there a way to do this? 
>>> 
>>> -Carl
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIActivityIndicatorView to send an action

2022-10-14 Thread Carl Hoefs via Cocoa-dev
The idea just occurred to me to place a clear UIButton atop the spinner and 
have that send the action. That will work but just seems kinda hacky...

> On Oct 14, 2022, at 12:30 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> Got an iPhone app enhancement request today to be able to tap the spinning 
> activity indicator (UIActivityIndicatorView) to pop up some info on the 
> status of the busy activity. 
> 
> UIActivityIndicatorView isn't like a UIButton which has sent actions, so is 
> there a way to do this? 
> 
> -Carl
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UIActivityIndicatorView to send an action

2022-10-14 Thread Carl Hoefs via Cocoa-dev
Got an iPhone app enhancement request today to be able to tap the spinning 
activity indicator (UIActivityIndicatorView) to pop up some info on the status 
of the busy activity. 

UIActivityIndicatorView isn't like a UIButton which has sent actions, so is 
there a way to do this? 

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa framework for GPU utilization

2022-09-24 Thread Carl Hoefs via Cocoa-dev
Whoa.. That could be a show-stopper, since we're doing real-time scientific 
modelling not gaming (where the highest possible accuracy / lowest possible 
error isn't required).

Is that by design, or just the current implementation of Metal? Metal 4 
perhaps...?
-Carl


> On Sep 24, 2022, at 7:54 AM, Richard Charles  wrote:
> 
> Just a heads up. Metal does not support the double data type.
> 
> Richard
> 
> 
>> On Sep 22, 2022, at 2:37 PM, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> Yes, Metal seems to be the way to go with this... and it looks like there's 
>> a wee learning curve to it!
>> Thanks for the links. This gets me started.
>> 
>> -Carl
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa framework for GPU utilization

2022-09-22 Thread Carl Hoefs via Cocoa-dev
Yes, Metal seems to be the way to go with this... and it looks like there's a 
wee learning curve to it!
Thanks for the links. This gets me started.

-Carl


> On Sep 21, 2022, at 4:47 PM, Gabriel Jacoby-Cooper  
> wrote:
> 
> You can try writing a GPU program in the Metal Shading Language 
> <https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf> 
> and then dispatch that program to the GPU using the Metal 
> <https://developer.apple.com/metal/> framework in your Cocoa app.
> 
> Thanks,
> Gabriel Jacoby-Cooper
> Rensselaer Polytechnic Institute
> 
>> On Sep 21, 2022, at 4:42 PM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I just got a new M1 Max Mac Studio (10-core CPU / 32-core GPU / 16-core 
>> neural engine). How can I take advantage of the GPUs and "neural" engine 
>> from Cocoa? Is there a Cocoa framework or other API to access these?
>> 
>> In my case, I have a highly parallelizable Cocoa task that uses 
>> dispatch_apply() to run on all CPUs simultaneously. It averages about 0.2s 
>> per process thread, but doesn't utilize the GPUs, only the CPUs. I'm sure 
>> that offloading this task to the GPUs would speed this up tremendously, but 
>> I don't know where to start.
>> 
>> Thx,
>> -Carl
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/gjacobycooper%40icloud.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/gjacobycooper%40icloud.com>
>> 
>> This email sent to gjacobycoo...@icloud.com <mailto:gjacobycoo...@icloud.com>
___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Cocoa framework for GPU utilization

2022-09-21 Thread Carl Hoefs via Cocoa-dev
I just got a new M1 Max Mac Studio (10-core CPU / 32-core GPU / 16-core neural 
engine). How can I take advantage of the GPUs and "neural" engine from Cocoa? 
Is there a Cocoa framework or other API to access these?

In my case, I have a highly parallelizable Cocoa task that uses 
dispatch_apply() to run on all CPUs simultaneously. It averages about 0.2s per 
process thread, but doesn't utilize the GPUs, only the CPUs. I'm sure that 
offloading this task to the GPUs would speed this up tremendously, but I don't 
know where to start.

Thx,
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: App can't be opened

2021-09-09 Thread Carl Hoefs via Cocoa-dev
On a 10.13 system, your app gives this in the console log:

opendirectoryd: Authentication failed for  with result 
ODErrorCredentialsInvalid
opendirectoryd: ODRecordVerifyPassword failed with result 
ODErrorCredentialsInvalid

The (extensive) crash log has this at the top:

Crashed Thread:0

Exception Type:EXC_CRASH (SIGABRT)
Exception Codes:   0x, 0x
Exception Note:EXC_CORPSE_NOTIFY

Termination Reason:DYLD, [0x4] Symbol missing

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Symbol not found: _AVAudioSessionInterruptionNotification
  Referenced from: /Applications/ArtSaverApp.app/Contents/MacOS/ArtSaverApp
  Expected in: 
/System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation
 in /Applications/ArtSaverApp.app/Contents/MacOS/ArtSaverApp

-Carl


> On Sep 9, 2021, at 10:54 AM, Jack Brindle via Cocoa-dev 
>  wrote:
> 
> In 10.13 this is not a Notarization problem. It could be a quarantine 
> problem, though. Have him move the application to any directory other than 
> the one where he unzipped the app, then launch the app. That should remove 
> the quarantine and allow him to run the app if that was the problem. The 
> Applications folder is a good place to move these things.
> 
> Jack
> 
> 
>> On Sep 9, 2021, at 12:45 PM, Rob Petrovec via Cocoa-dev 
>>  wrote:
>> 
>> The text in an error dialog is typically a washed down version of the actual 
>> error.  See if you can get the user to give you a sysdiagnose log, taken 
>> just after reproducing the problem, so you can check out the .logarchive to 
>> see what the actual error was from the system.  It should provide more 
>> insight into what the problem actually is.
>> 
>> btw, if you sent the app as a zip file you should double check the 
>> permissions on the app, including its bundle contents.  Your uid may not be 
>> the same has the users uid, so the privs could be set to not allow anyone 
>> but you to open it.  Thats why installers are better than sending the raw 
>> bits.
>> 
>> —Rob
>> 
>> 
>>> On Sep 9, 2021, at 7:13 AM, Gabriel Zachmann via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> I have compiled my app for macOS 10.12, because one user runs macOS 10.13.
>>> 
>>> Now he reports that he gets the error message "app can't be opened due to a 
>>> problem"
>>> (the err message is in German, but I guess this is what it would say in 
>>> English.)
>>> 
>>> The error message does NOT say ".. unidentified developer"
>>> and it does NOT say ".. cannot check it for malicious software".
>>> 
>>> I have notarized my app using Xcode's Archive utility.
>>> I sent the user the app as a zip file - if you want , you can try it for 
>>> yourself:
>>> 
>>>  https://owncloud.informatik.uni-bremen.de/index.php/s/9i3DCYodkgHZeZw
>>> 
>>> It goes without saying that I can run the app from that very zip file on my 
>>> Mac.
>>> 
>>> Does anyone have an idea what might be causing this funny error message?
>>> 
>>> Best, G.
>>> 
>>> ___
>>> 
>>> 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.com/mailman/options/cocoa-dev/petrock%40mac.com 
>>> 
>>> 
>>> This email sent to petr...@mac.com 
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/jackbrindle%40me.com 
>> 
>> 
>> This email sent to jackbrin...@me.com 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email 

MacOS: nonmodal NSAlert panel

2021-05-12 Thread Carl Hoefs via Cocoa-dev
I had thought it was possible on MacOS to run an NSAlert panel nonmodally...

I'd like to present an informational alert for n seconds then dismiss it 
without user interaction. But I don't see any way to dismiss, terminate, 
cancel, invalidate, etc. an NSAlert object.

I know this is possible in iOS, but is there no way to do this in MacOS, other 
than displaying/hiding an NSPanel of my own?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Cocoa dylib access by C program

2020-11-13 Thread Carl Hoefs via Cocoa-dev
Yes, that's nice, clean approach, and will do what I need.

Thanks!
-Carl


> On Nov 13, 2020, at 11:42 AM, Martin Wierschin  wrote:
> 
> A nice way to do this is to have a bridge header file that only declares C 
> functions. The corresponding .m source code file will have C functions that 
> natively call Objective-C methods. This same header can be included in .c 
> files without any trouble, letting them have access to Obj-C code via the 
> bridge's C functions.
> 
> Basically structure your files something like this:
> 
>  MyBridge.h
> extern void DoObjectiveCStuff();
> 
>  MyBridge.m
> #import 
> 
> void DoObjectiveCStuff()
> {
>   NSLog(@"Hooray, calling Obj-C methods...");
>   [NSArray arrayWithCapacity:32];
> }
> 
>  pure.c
> #include "MyBridge.h"
> 
> void RegularFunction()
> {
>   DoObjectiveCStuff();
> }
> 
> I hope that helps!
> 
> ~Martin Wierschin
> 
> 
>> On Nov 13, 2020, at 11:16 AM, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> I have built an ObjC/Cocoa/Foundation library.dylib; it works well when 
>> linked with ObjC apps. 
>> 
>> But now I need to link a C program against that library. How do I invoke the 
>> ObjC library methods from a C program? (I know I can add C function entry 
>> points to the library, but how do they invoke the internal ObjC library 
>> methods?)
>> 
>> -Carl
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Cocoa dylib access by C program

2020-11-13 Thread Carl Hoefs via Cocoa-dev
I have built an ObjC/Cocoa/Foundation library.dylib; it works well when linked 
with ObjC apps. 

But now I need to link a C program against that library. How do I invoke the 
ObjC library methods from a C program? (I know I can add C function entry 
points to the library, but how do they invoke the internal ObjC library 
methods?)

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Scaling a UIImage

2020-11-04 Thread Carl Hoefs via Cocoa-dev
Thanks for the UIImage category resizing methods! They are quite useful.

-Carl

> On Nov 4, 2020, at 2:17 PM, Alex Zavatone  wrote:
> 
> Sorry for the delay.  I hope these do what you need.
> Of course you’ll need to add checks to make sure that you’re not dividing by 
> zero or nil.
> 
> 
> 
> // Alex Zavatone 4/2/16.
> + (UIImage *)imageWithImage:(UIImage *)image 
> scaledToHeight:(CGFloat)newHeight 
> {
> CGFloat ratio = newHeight / image.size.height;
> CGFloat newWidth = image.size.width * ratio;
> 
> CGSize newSize = CGSizeMake(newWidth, newHeight);
> //UIGraphicsBeginImageContext(newSize);
> // In next line, pass 0.0 to use the current device's pixel scaling 
> factor (and thus account for Retina resolution).
> // Pass 1.0 to force exact pixel size.
> UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
> [image drawInRect:CGRectMake(0, 0, newWidth, newHeight)];
> UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
> UIGraphicsEndImageContext();
> return newImage;
> }
> 
> 
> + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize 
> {
> //UIGraphicsBeginImageContext(newSize);
> // In next line, pass 0.0 to use the current device's pixel scaling 
> factor (and thus account for Retina resolution).
> // Pass 1.0 to force exact pixel size.
> UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
> [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
> UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
> UIGraphicsEndImageContext();
> return newImage;
> }
> 
> + (UIImage *)imageWithImage:(UIImage *)image 
> scaledToPercentage:(CGFloat)newScale 
> {
> CGSize newSize = CGSizeMake(image.size.width * newScale, image.size.width 
> * newScale);
> UIImage *newImage = [self imageWithImage:image scaledToSize:newSize];
> 
> return newImage;
> }
> 
> 
> Cheers,
> Alex Zavatone
> 
> 
>> On Nov 3, 2020, at 10:34 AM, James Crate via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> On Nov 2, 2020, at 5:59 PM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>>> I have an iOS app that interacts with a macOS server process. The iOS app 
>>> takes a 3264x2448 camera image, scales it to 640x480 pixels, and makes a 
>>> JPEG representation of it to send to the server:
>> 
>> I have code that does pretty much the same thing, in Swift though so you’ll 
>> need to convert the API calls to ObjC. Since you’re taking a picture, you 
>> could use the AVCapturePhoto directly. 
>> 
>> 
>>let capture : AVCapturePhoto
>>private lazy var context = CIContext()
>> 
>>lazy var remotePreviewImage: Data? = {
>>guard let cgImage = 
>> self.capture.cgImageRepresentation()?.takeRetainedValue() else { return nil }
>> 
>>var baseImg = CIImage(cgImage: cgImage)
>> 
>>if let orientation = self.capture.metadata[ 
>> String(kCGImagePropertyOrientation) ] as? Int32 {
>>baseImg = baseImg.oriented(forExifOrientation: orientation)
>>}
>> 
>>let scalePct = [800.0 / baseImg.extent.size.width, 800.0 / 
>> baseImg.extent.size.height].max() ?? 0.3
>>let transformedImg = baseImg.transformed(by: 
>> CGAffineTransform(scaleX: scalePct, y: scalePct))
>>print("generated remote preview image \(transformedImg.extent.size)")
>> 
>>let colorspace : CGColorSpace = baseImg.colorSpace ?? 
>> CGColorSpace(name: CGColorSpace.sRGB)!
>>let compressionKey = CIImageRepresentationOption(rawValue: 
>> kCGImageDestinationLossyCompressionQuality as String)
>>let data = self.context.jpegRepresentation(of: transformedImg, 
>> colorSpace: colorspace,
>>   options: [compressionKey : 
>> 0.6])
>>print("photo generated preview \(data?.count ?? 0) bytes")
>>return data
>>}()
>> 
>> 
>> I had a previous version that used ImageIO. I don’t remember why I switched 
>> but I still had the commented code hanging around.  
>> 
>> //lazy var remotePreviewImage: Data? = {
>> //guard let data = self.capture.fileDataRepresentation() else { 
>> return nil }
>> //guard let src = CGImageSourceCreateWithData(data as NSData, nil) 
>> else { return nil }
>> //let thumbOpts = [
>> //kCGImageSourc

Re: Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
Okay. It was my understanding that -TIFFRepresentation was the only way to get 
serializable image data bytes... What is a more efficient way to do this?
-Carl


> On Nov 2, 2020, at 3:09 PM, David Duncan  wrote:
> 
> Also any code using -TIFFRepresentation for any reason other than to get 
> actual TIFF data is likely suspect. There are absolutely more efficient ways 
> to do this.

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
Yes! That's what I overlooked. "native" isn't what I intended.

Thanks!
-Carl


> On Nov 2, 2020, at 3:09 PM, David Duncan  wrote:
> 
>>   UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
> 
> Explicitly pass 1 here.
> 
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Scaling a UIImage

2020-11-02 Thread Carl Hoefs via Cocoa-dev
How can I correctly scale a UIImage from 3264x2448 down to 640x480 pixels?


I have an iOS app that interacts with a macOS server process. The iOS app takes 
a 3264x2448 camera image, scales it to 640x480 pixels, and makes a JPEG 
representation of it to send to the server:

  NSData *dataObj = UIImageJPEGRepresentation(origImage,0.5);

The server reads the bytes, and creates an NSImage:

  NSImage *theImage = [[NSImage alloc] initWithData:imageData];
  NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:[theImage 
TIFFRepresentation]];

But at this point, imageRep.pixelsWide=1280 and imageRep.pixelsHigh=960!

If I write theImage to disk and look at it with Preview, it displays onscreen 
as 640x480 but Preview's Inspector Tool shows it to be 1280x960.

On the iOS app side, here's the UIImage category method I'm using to scale the 
image:

+ (UIImage *)imageWithImage:(UIImage *)image 
   scaledToSize:(CGSize)newSize 
{
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}

Any suggestions?
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Rotating NSTextField 90 degrees

2020-09-24 Thread Carl Hoefs via Cocoa-dev
Both work perfectly:

   m4TField.layer.transform = CATransform3DMakeRotation(3.14159/2.0,0,0,1);

- or -

   [m4TField setFrameRotation:90.0];

Thanks!
-Carl


> On Sep 24, 2020, at 9:19 PM, Alex Zavatone  wrote:
> 
> http://digerati-illuminatus.blogspot.com/2009/09/how-do-you-rotate-nsbutton-nstextfield.html
> 
> 
> 
>> On Sep 24, 2020, at 11:09 PM, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> In my MacOS app I need to display some vertical text (normal text rotated 90 
>> degrees counterclockwise).
>> 
>> I don't see anything in NSTextField or Xcode IB that allows a change of 
>> orientation. Could NSAttributedString be used to do this, or is there some 
>> CoreGraphics way?
>> 
>> -Carl
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Rotating NSTextField 90 degrees

2020-09-24 Thread Carl Hoefs via Cocoa-dev
In my MacOS app I need to display some vertical text (normal text rotated 90 
degrees counterclockwise).

I don't see anything in NSTextField or Xcode IB that allows a change of 
orientation. Could NSAttributedString be used to do this, or is there some 
CoreGraphics way?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Invalidating UIImageView's image cache

2020-09-23 Thread Carl Hoefs via Cocoa-dev
Yes! +[UIImage imageNamed:] was The Caching Culprit™️. I was barking up the 
wrong object (UIImageView).

As per Eric's suggestion I've switch to +[UIImage imageWithContentsOfFile:], 
and now there's no image caching (as per  Mike's suggestion to RTM: "This 
method does not cache the image object". I simply didn't notice/expect the docs 
would comment on that).

Plus my code is much cleaner now as I can stop the flail of uniquing the 
filenames, deleting the sandbox files, etc...

Thanks Eric & Mike!
-Carl



> On Sep 23, 2020, at 1:34 AM, Mike Abdullah  wrote:
> 
> Correct, this is your issue. Have a read of the docs on +[UIImage 
> imageNamed:]   They explicitly discuss the cache. This is not the API you 
> want.
> 
> Mike.
> 
>> On 23 Sep 2020, at 02:12, Eric Lee via Cocoa-dev  
>> wrote:
>> 
>> Ah maybe it is the use of `imageNamed:`.  I believe that caches the image 
>> data in a system cache.  Have you tried `imageWithContentsOfFile:`?
>> 
>> https://developer.apple.com/documentation/uikit/uiimage/1624123-imagewithcontentsoffile
>> 
>>> On Sep 22, 2020, at 16:56, Carl Hoefs  
>>> wrote:
>>> 
>>> 
>>>> On Sep 22, 2020, at 1:46 PM, Eric Lee via Cocoa-dev 
>>>>  wrote:
>>>> 
>>>>> I don't have a good answer, but I think this may be more that UIImage 
>>>>> caches the images, not UIImageView. Maybe you can find something in 
>>>>> UIImage's docs/headers?
>>>> 
>>>> I think you may be on to something.  This WWDC 
>>>> <https://developer.apple.com/videos/play/wwdc2018/219> session covers 
>>>> optimizing UIImage performance and has some info on what UIImage caches.
>>>> 
>>>> How are you creating the UIImage?  Are you retaining the UIImage anywhere 
>>>> outside of the UIImageView? 
>>> 
>>> 
>>> The path of UIImage creation is as follows:
>>> 
>>> - For each manually-initiated processing pass of the app, a standard set of 
>>> 12 JPG files is written to the sandbox using the OpenCV::imwrite() 
>>> function, which creates a JPG from data values. The files have fixed 
>>> filenames.
>>> 
>>> - When all 12 JPG files for a pass are written, I then use the following 
>>> code snippet to create the UIImages and display them on the main 
>>> UIImageView:
>>> 
>>>  NSMutableArray *uiImagesArray = [NSMutableArray new];
>>>  for (NSString *file in [[NSFileManager defaultManager] 
>>> contentsOfDirectoryAtPath:self.sandboxPath error:NULL]) {
>>>  if ([file.pathExtension isEqualToString:@"jpg"]) {
>>>  UIImage *tempImage = [UIImage imageNamed:jpgFilename];
>>>  if (tempImage) [uiImagesArray addObject:tempImage];
>>>  }
>>>  }
>>>  UIImage *allAGFAImages = [UIImage animatedImageWithImages:uiImagesArray 
>>> duration:20.0];
>>>  self.imageView.image = allAGFAImages;
>>> 
>>> - When a new pass of the app is run, the sandbox contents are deleted (see 
>>> below), the uiImagesArray variable is set to nil, and the new JPG files are 
>>> written, using the same filenames as before. Note that I do not set each 
>>> UIImage in the array explicitly to nil.
>>> 
>>>  [[NSFileManager defaultManager] removeItemAtURL:[NSURL 
>>> fileURLWithPath:[self.sandboxPath stringByAppendingPathComponent:file]] 
>>> error:];
>>> 
>>> - If I add a uniquing string to the filenames for each pass, the problem 
>>> does not present itself. Otherwise the original (old) cached image contents 
>>> are displayed until the app is restarted.
>>> 
>>> - I don't retain the UIImages anywhere other than adding them to the array 
>>> in the code snippet above.
>>> 
>>> -Carl
>>> 
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/mabdullah%40karelia.com
>> 
>> This email sent to mabdul...@karelia.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Invalidating UIImageView's image cache

2020-09-22 Thread Carl Hoefs via Cocoa-dev


> On Sep 22, 2020, at 1:46 PM, Eric Lee via Cocoa-dev 
>  wrote:
> 
>> I don't have a good answer, but I think this may be more that UIImage caches 
>> the images, not UIImageView. Maybe you can find something in UIImage's 
>> docs/headers?
> 
> I think you may be on to something.  This WWDC 
>  session covers 
> optimizing UIImage performance and has some info on what UIImage caches.
> 
> How are you creating the UIImage?  Are you retaining the UIImage anywhere 
> outside of the UIImageView? 


The path of UIImage creation is as follows:

- For each manually-initiated processing pass of the app, a standard set of 12 
JPG files is written to the sandbox using the OpenCV::imwrite() function, which 
creates a JPG from data values. The files have fixed filenames.

- When all 12 JPG files for a pass are written, I then use the following code 
snippet to create the UIImages and display them on the main UIImageView:

NSMutableArray *uiImagesArray = [NSMutableArray new];
for (NSString *file in [[NSFileManager defaultManager] 
contentsOfDirectoryAtPath:self.sandboxPath error:NULL]) {
if ([file.pathExtension isEqualToString:@"jpg"]) {
UIImage *tempImage = [UIImage imageNamed:jpgFilename];
if (tempImage) [uiImagesArray addObject:tempImage];
}
}
UIImage *allAGFAImages = [UIImage animatedImageWithImages:uiImagesArray 
duration:20.0];
self.imageView.image = allAGFAImages;

- When a new pass of the app is run, the sandbox contents are deleted (see 
below), the uiImagesArray variable is set to nil, and the new JPG files are 
written, using the same filenames as before. Note that I do not set each 
UIImage in the array explicitly to nil.

[[NSFileManager defaultManager] removeItemAtURL:[NSURL 
fileURLWithPath:[self.sandboxPath stringByAppendingPathComponent:file]] 
error:];

- If I add a uniquing string to the filenames for each pass, the problem does 
not present itself. Otherwise the original (old) cached image contents are 
displayed until the app is restarted.

- I don't retain the UIImages anywhere other than adding them to the array in 
the code snippet above.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Invalidating UIImageView's image cache

2020-09-01 Thread Carl Hoefs via Cocoa-dev
Q: What is the proper way to invalidate UIImageView's image cache?

- - -

I have an iPad app that generates a series of medical analysis UIImages in the 
~/Documents area of the sandbox. I then display those images in an automated 
sequence on the GUI.

Each time the app runs through its processing loop, it generates a new set of 
analysis images _of the same filename_ in the ~/Documents area of the sandbox, 
effectively overwriting the previous set of files there. 

To display (sequence through) the generated images, I feed them to UIImageView 
with 
imageView.image = [UIImage animatedImageWithImages::]...
or 
imageView.animationImages = [NSArray ]...

So far, so good; they display nicely. But, once an initial set of images has 
been fed to UIImageView, it will _not_ update the images displayed with a new 
set (because they have the same filenames); instead UIImageView displays the 
originally cached set, even though that version of the file set no longer 
exists in the sandbox.

I've tried setting UIImageView.image=nil, UIImageView.animationImages=nil, 
toggling UIImageView.hidden, wiping the sandbox, etc., but no joy. Of course, 
restarting the app does force-flush the cache, but that's a no-go.

The only way I've found to invalidate UIImageView's caching (without killing 
the app) is to play games like generating unique filenames for each run of the 
processing loop of the app. Apparently UIImageView tracks _filenames_ to 
determine when to flush/update its cache!

So, if there actually exists a kosher way to do this, I welcome any/all hints!

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AddInstanceForFactory: No factory registered for id

2020-08-18 Thread Carl Hoefs via Cocoa-dev
Run a test using the system .aif sound files: they won't work. 
Convert them to .mp3 files: they do work.
That's what I mean by "in my experience".

Mark


> On Aug 18, 2020, at 1:56 PM, Jens Alfke  wrote:
> 
> 
> 
>> On Aug 18, 2020, at 11:10 AM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> In my experience, playing sounds (in macOS apps) only works when using mp3 
>> files.
> 
> I disagree. NSSound supports all the formats CoreAudio does, and normally for 
> brief sounds people use AIFF.
> 
> I can't imagine any feature supporting _only_ MP3; it's an archaic format. 
> Apple doesn't even provide an MP3 encoder in the OS, for complicated legal 
> reasons. (Yes, iTunes/Music can encode MP3s, but that's because there's en 
> encoder in the app, not accessible to other software.)
> 
> —Jens

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AddInstanceForFactory: No factory registered for id

2020-08-18 Thread Carl Hoefs via Cocoa-dev


> On Aug 18, 2020, at 10:33 AM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> (I have already experimented with AudioServicesCreateSystemSoundID(), but 
> failed.)

In my experience, playing sounds (in macOS apps) only works when using mp3 
files.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag-and-drop onto an NSTextField?

2020-08-01 Thread Carl Hoefs via Cocoa-dev
I was wondering also about the necessity of:

[self setNeedsDisplay:YES];

It seems to work fine without it (perhaps it's already being done by the 
superclass, NSTextField?).

-Carl



> On Aug 1, 2020, at 5:28 AM, Graham Cox  wrote:
> 
> You shouldn’t call -becomeFirstResponder yourself.
> 
> Instead, call [self.window makeFirstResponder:self].
> 
> That should properly switch the first responder, giving the previous 
> responder the chance to refuse. Of course, that’s more obstructive if the 
> previous responder DOES refuse, but that’s what they tell you to do (from the 
> documentation on [NSReponder becomeFirstResponder]:
> 
>> Use the NSWindow makeFirstResponder: 
>>  method, not this method, to 
>> make an object the first responder. Never invoke this method directly.
> 
> 
> —Graham
> 
> 
> 
>> On 1 Aug 2020, at 10:16 am, Sandor Szatmari via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I call…
>> 
>> [self becomeFirstResponder]
>> [self setNeedsDisplay:YES]
>> 
>> Then return the drag operation required.
>> 
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag-and-drop onto an NSTextField?

2020-07-31 Thread Carl Hoefs via Cocoa-dev
Sandor,

Ah! That's quite clever... and it works, too!

Thanks!
-Carl


> On Jul 31, 2020, at 5:16 PM, Sandor Szatmari  
> wrote:
> 
> Carl,
> 
>> On Jul 31, 2020, at 20:07, Carl Hoefs  wrote:
>> 
>> Hmm, subleasing NSTextField doesn't work for me (the dragged item gets 
>> rejected). I've got the  protocol in my subclass of 
>> NSTextField.
>> 
>> Is there something I need to set in -draggingEntered:?
> 
> I call…
> 
> [self becomeFirstResponder]
> [self setNeedsDisplay:YES]
> 
> Then return the drag operation required.
> 
> Sandor
> 
>> I return NSDragOperationCopy.
>> 
>> Are there any other methods besides -draggingEntered: that must also be 
>> overridden? 
>> 
>> -Carl
>> 
>> 
>>> On Jul 31, 2020, at 4:49 PM, Sandor Szatmari  
>>> wrote:
>>> 
>>> For NSTexrField I have always created a subclass for my textfields
>>> 
>>> I call -registerForDraggedTypes: in -awakeFromNib in the subclass
>>> 
>>> And then to accept the drag implement the method in the sublclass
>>> 
>>>   -(NSDragOperation)draggingEntered:(id)sender
>>> 
>>> If there’s an easier or better it’d be cool to learn about it
>>> 
>>> Sandor
>>> 
>>>> On Jul 31, 2020, at 19:29, Carl Hoefs via Cocoa-dev 
>>>>  wrote:
>>>> 
>>>> Why is drag-and-drop onto an NSTextField enabled only when it has focus? 
>>>> 
>>>> Is there any way around this?
>>>> 
>>>> -Carl
>>>> 
>>>> ___
>>>> 
>>>> 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.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com
>>>> 
>>>> This email sent to admin.szatmari@gmail.com
>> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Drag-and-drop onto an NSTextField?

2020-07-31 Thread Carl Hoefs via Cocoa-dev
Why is drag-and-drop onto an NSTextField enabled only when it has focus? 

Is there any way around this?

-Carl
 
___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Points vs pixels in a bash script

2020-06-08 Thread Carl Hoefs via Cocoa-dev
Note that your AppleScript returns the size of ALL monitors combined. 
With four 1920x1080 monitors in a 2x2 arrangement it shows:

0, 0, 3840, 2160

-Carl



> On Jun 8, 2020, at 3:44 PM, Marco S Hyman via Cocoa-dev 
>  wrote:
> 
> Using
>>  system_profiler SPDisplaysDataType
>> I can retrieve the size of a Mac's display in pixels. 
>> 
>> However, the command
>> 
>>  tell application "System Events" to get the size of every window of every 
>> process
> 
> 
> tell application “Finder”
> set screen_resolution to bounds of window of desktop
> end tell
> 
> screen_resolution on my 5K iMac is 0, 0, 2560, 1440
> 
> Marc
> ___

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to save a window's position and size

2020-05-25 Thread Carl Hoefs via Cocoa-dev
You could try setting your self.masterViewController.view as self.window's 
initial first responder.

(But I get the feeling you're "fighting the Frameworks" here...)

-Carl


> On May 25, 2020, at 11:48 AM, Gabriel Zachmann  wrote:
> 
> Thanks a lot for the response.
>> 
>>   [self.window setFrame:[[NSScreen mainScreen] frame] display:YES];
> 
> It sort of works, but the window still has borders.
> 
> I tried this:
> 
>   [self.window toggleFullScreen: nil];
> 
> and it makes the app start in real full-screen (no window borders),
> but then it does not receive keystrokes (I get the "ponk" sound).
> I have to CMD-tab to a different app first, then CMD_Tab back, then it gets 
> keystrokes.
> 
> I tried the line also in the AppDelegate's applicationDidFinishLaunching - 
> same problem.
> 
> Any ideas?
> 
> Best regards, Gabriel
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to save a window's position and size

2020-05-25 Thread Carl Hoefs via Cocoa-dev
Something like this would work (in -applicationWillFinishLaunching:):

[self.window setFrame:[[NSScreen mainScreen] frame] display:YES];

-Carl


> On May 24, 2020, at 3:09 PM, Gabriel Zachmann  wrote:
> 
> Alternatively, is there a way to start it such that it always starts in 
> fullscreen,
> no matter the window size/position when the user quit it last time?

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to save a window's position and size

2020-05-23 Thread Carl Hoefs via Cocoa-dev
No guarantees, but you could try moving your code into an AppDelegate method 
that gets invoked earlier:

- (void)applicationWillFinishLaunching:(NSNotification *)notification;

-Carl


> On May 23, 2020, at 12:53 PM, Gabriel Zachmann  wrote:
> 
> Actually, after observing the new behavior for a while, 
> I have to say it's "almost" perfect.
> 
> The window still opens at some funny position with a smallish size (where is 
> that stored?),
> but with no content, just grey inside, for a split second, 
> then it snaps to the autosaved position/size.
> 
> It's OK, but is there a way to make it appear directly at the autosaved 
> position?
> 
> Best regards, Gabriel
> 
> 
> PS:
> For reference, this is what I do in AppDelegate's 
> applicationDidFinishLaunching:
> 
> - (void) applicationDidFinishLaunching: (NSNotification *) aNotification
> {
>[self.window setDelegate: self]; 
> 
>self.masterViewController = [[MasterViewController alloc] initWithNibName: 
> @"MasterViewController" bundle: nil];
> 
>[self.window.contentView addSubview: self.masterViewController.view];
>self.masterViewController.view.frame = ((NSView*) 
> self.window.contentView).bounds;
>[self.window makeFirstResponder: self.masterViewController.view];
> 
>[self.window setFrameAutosaveName: @"myApp"];
> }
> 
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to save a window's position and size

2020-05-22 Thread Carl Hoefs via Cocoa-dev
The referenced documentation code (©2009) appears to be a wee bit outdated...

Try supplying your own NSString for the auto save name, as [window 
representedFilename] no longer seems to return a valid 
NSWindowFrameAutosaveName.

In AppDelegate.m I have this and it works:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[self.window setFrameAutosaveName:@"NSWindowFrameAutosaveName"];
}

-Carl


> On May 22, 2020, at 2:22 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> I am trying to follow these instructions:
> 
> https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Tasks/SavingWindowPosition.html
> 
> However, my app doesn't have a NSWindowController.
> It just has a NSViewController and an AppDelegate.
> 
> So i thought I could stick the two lines of code mentioned in the doc in one 
> of the app delegate's methods.
> 
> I tried to put them in applicationDidFinishLaunching, but they don't have an 
> effect.
> I tried to define -awakeFromNib in the app delegate and put them there,
> but awakeFromNib never gets called.
> 
> I defined -windowDidLoad in the app delegate, but that, too, never gets 
> called.
> (However, other methods like windowWillClose or windowDidEndLiveResize do get 
> called.)
> 
> Any hints how to achieve the goal will be appreciated.
> 
> Best regards, Gabriel
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
Cosmic rays? Disk corruption? Tired bits? Embedded escapes? Xcode cruft? 

Whatever the bug-a-boo was, with a freshly reinstalled Xcode (11.2.1) and 
command line tools, it's gone! I blew everything away and rebuilt the project 
and It Just Works™️.

Thanks for all the support. Sorry for the noise!
-Carl

p.s. - isn't this supposed to only happen on Fridays at 5:00pm?


> On Apr 29, 2020, at 2:45 PM, Carl Hoefs  
> wrote:
> 
> When everything goes wonky... it's time to reinstall all of Xcode...!
> 
> *sigh*
> -Carl
> 
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
When everything goes wonky... it's time to reinstall all of Xcode...!

*sigh*
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
There are no extensions or categories in the project. 
I changed the -newData: method name to -arrivalOfNewData:. 
I changed the newTimer variable name to theTimer. 
I rebooted the machine. 

No joy.

I realize this is no longer a Cocoa problem, but what - even theoretically - 
could cause this? 
As shown in the debugger, the timer gets created with the wrong time interval 
value, by a consistent factor of 20.

-Carl


> On Apr 29, 2020, at 2:24 PM, Andy Lee  wrote:
> 
> I did the same just now in a macOS project.  Copied your code and added a 
> newData: method.  This is with Xcode 11.2.1 on Mojave, 10.4.6.  Works fine 
> for me.  Weird!
> 
> @implementation AppDelegate
> 
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
> NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 1/sec
> target:self
>   selector:@selector(newData:)
>   userInfo:nil
>repeats:YES];
> [[NSRunLoop mainRunLoop] addTimer:newTimer
>   forMode:NSRunLoopCommonModes];
> }
> 
> - (void)newData:(NSTimer *)timer {
> NSLog(@"timer is %@", timer);
> }
> 
> @end
> 
> 2020-04-29 17:20:45.331469-0400 NSTimerQuestion[21676:3985041] Metal API 
> Validation Enabled
> 2020-04-29 17:20:46.413190-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x6370eb80>
> 2020-04-29 17:20:47.412968-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x6370eb80>
> 2020-04-29 17:20:48.413525-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x6370eb80>
> 2020-04-29 17:20:49.413373-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x6370eb80>
> 2020-04-29 17:20:50.412610-0400 NSTimerQuestion[21676:3985041] timer is 
> <__NSCFTimer: 0x6370eb80>
> ...
> 
> --Andy
> 
> On Apr 29, 2020, at 5:15 PM, Alex Zavatone via Cocoa-dev 
> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I used your code in an iOS project and it works as expected.
>> 
>> 2020-04-29 16:14:02.254107-0500 Timer[83275:13268128] Wed Apr 29 16:14:02 
>> 2020
>> 2020-04-29 16:14:03.254048-0500 Timer[83275:13268128] Wed Apr 29 16:14:03 
>> 2020
>> 2020-04-29 16:14:04.253957-0500 Timer[83275:13268128] Wed Apr 29 16:14:04 
>> 2020
>> 2020-04-29 16:14:05.254170-0500 Timer[83275:13268128] Wed Apr 29 16:14:05 
>> 2020
>> 2020-04-29 16:14:06.254490-0500 Timer[83275:13268128] Wed Apr 29 16:14:06 
>> 2020
>> 2020-04-29 16:14:07.254570-0500 Timer[83275:13268128] Wed Apr 29 16:14:07 
>> 2020
>> 2020-04-29 16:14:08.254651-0500 Timer[83275:13268128] Wed Apr 29 16:14:08 
>> 2020
>> 2020-04-29 16:14:09.253715-0500 Timer[83275:13268128] Wed Apr 29 16:14:09 
>> 2020
>> 2020-04-29 16:14:10.254741-0500 Timer[83275:13268128] Wed Apr 29 16:14:10 
>> 2020
>> 
>> I’ll mail you the project offlist.
>> 
>> 
>> 
>>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> On Apr 29, 2020, at 1:53 PM, Carl Hoefs via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>>> 
>>>> On Apr 29, 2020, at 1:43 PM, Steve Mills via Cocoa-dev 
>>>> mailto:cocoa-dev@lists.apple.com> 
>>>> <mailto:cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>>> 
>>>> wrote:
>>>>> 
>>>>> On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev 
>>>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>>>>> 
>>>>>> When I issue NSTimer's +timerWithTimeInterval: method, I'm getting 
>>>>>> unexpected timer firing times (20X faster than expected).
>>>>>> 
>>>>>> ∙ If I specify 1.0 for the time interval, my method gets called 20 
>>>>>> times/sec. 
>>>>>> ∙ If I specify 20.0 for the time interval, my method gets called 1 
>>>>>> time/sec.
>>>>>> ∙ If I specify 100.0 for the time interval, my method gets called 5 
>>>>>> times/sec.
>>>>>> ...etc.
>>>>>> 
>>>>>> Here is my only invocation, called once and nevermore:
>>>>>> 
>>>>>>NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
>>>>>> 1/sec
>>>>>>  

Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
I accept that NSTimer works as documented! But I allege there must be something 
odd about my (inherited) project that I can't quite put my finger on.

Perhaps the +timerWithTimeInterval: method is overridden...
-Carl


> On Apr 29, 2020, at 2:15 PM, Alex Zavatone  wrote:
> 
> I used your code in an iOS project and it works as expected.
> 
> 2020-04-29 16:14:02.254107-0500 Timer[83275:13268128] Wed Apr 29 16:14:02 2020
> 2020-04-29 16:14:03.254048-0500 Timer[83275:13268128] Wed Apr 29 16:14:03 2020
> 2020-04-29 16:14:04.253957-0500 Timer[83275:13268128] Wed Apr 29 16:14:04 2020
> 2020-04-29 16:14:05.254170-0500 Timer[83275:13268128] Wed Apr 29 16:14:05 2020
> 2020-04-29 16:14:06.254490-0500 Timer[83275:13268128] Wed Apr 29 16:14:06 2020
> 2020-04-29 16:14:07.254570-0500 Timer[83275:13268128] Wed Apr 29 16:14:07 2020
> 2020-04-29 16:14:08.254651-0500 Timer[83275:13268128] Wed Apr 29 16:14:08 2020
> 2020-04-29 16:14:09.253715-0500 Timer[83275:13268128] Wed Apr 29 16:14:09 2020
> 2020-04-29 16:14:10.254741-0500 Timer[83275:13268128] Wed Apr 29 16:14:10 2020
> 
> I’ll mail you the project offlist.
> 
> 
> 
>> On Apr 29, 2020, at 4:07 PM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> On Apr 29, 2020, at 1:53 PM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> On Apr 29, 2020, at 1:43 PM, Steve Mills via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com> 
>>> <mailto:cocoa-dev@lists.apple.com <mailto:cocoa-dev@lists.apple.com>>> 
>>> wrote:
>>>> 
>>>> On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev 
>>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>>>> 
>>>>> When I issue NSTimer's +timerWithTimeInterval: method, I'm getting 
>>>>> unexpected timer firing times (20X faster than expected).
>>>>> 
>>>>> ∙ If I specify 1.0 for the time interval, my method gets called 20 
>>>>> times/sec. 
>>>>> ∙ If I specify 20.0 for the time interval, my method gets called 1 
>>>>> time/sec.
>>>>> ∙ If I specify 100.0 for the time interval, my method gets called 5 
>>>>> times/sec.
>>>>> ...etc.
>>>>> 
>>>>> Here is my only invocation, called once and nevermore:
>>>>> 
>>>>> NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
>>>>> 1/sec
>>>>> target:self
>>>>>   selector:@selector(newData:)
>>>>>   userInfo:nil
>>>>>repeats:YES];
>>>>> [[NSRunLoop mainRunLoop] addTimer:newTimer 
>>>>>   forMode:NSRunLoopCommonModes];
>>>> 
>>>> Sounds like multiple timers are being installed. Set a breakpoint that 
>>>> logs when hit.
>>>> 
>>> 
>>> On break, It's always the same timer. This is with time interval set to 
>>> 20.0:
>>> 
>>>   
>>> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:40 2020
>>> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:41 2020
>>> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:42 2020
>>> . . .
>>> 
>> 
>> I put a break directly after the creation of the timer, and introspection 
>> already shows the wrong value for the time interval! And since .timeInterval 
>> is a readonly attribute, I cannot force it to the correct value, nor is 
>> there a -setTimeInterval: method.
>> 
>> Argh...
>> -Carl
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto: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 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com>
>> 
>> This email sent to z...@mac.com <mailto:z...@mac.com>
___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
On Apr 29, 2020, at 1:53 PM, Carl Hoefs via Cocoa-dev 
 wrote:
> 
> On Apr 29, 2020, at 1:43 PM, Steve Mills via Cocoa-dev 
> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev 
>>  wrote:
>>> 
>>> When I issue NSTimer's +timerWithTimeInterval: method, I'm getting 
>>> unexpected timer firing times (20X faster than expected).
>>> 
>>> ∙ If I specify 1.0 for the time interval, my method gets called 20 
>>> times/sec. 
>>> ∙ If I specify 20.0 for the time interval, my method gets called 1 time/sec.
>>> ∙ If I specify 100.0 for the time interval, my method gets called 5 
>>> times/sec.
>>> ...etc.
>>> 
>>> Here is my only invocation, called once and nevermore:
>>> 
>>>  NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
>>> 1/sec
>>>  target:self
>>>selector:@selector(newData:)
>>>userInfo:nil
>>> repeats:YES];
>>>  [[NSRunLoop mainRunLoop] addTimer:newTimer 
>>>forMode:NSRunLoopCommonModes];
>> 
>> Sounds like multiple timers are being installed. Set a breakpoint that logs 
>> when hit.
>> 
> 
> On break, It's always the same timer. This is with time interval set to 20.0:
> 
>
> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:40 2020
> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:41 2020
> <__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:42 2020
> . . .
> 

I put a break directly after the creation of the timer, and introspection 
already shows the wrong value for the time interval! And since .timeInterval is 
a readonly attribute, I cannot force it to the correct value, nor is there a 
-setTimeInterval: method.

Argh...
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
On Apr 29, 2020, at 1:43 PM, Steve Mills via Cocoa-dev 
 wrote:
> 
> On Apr 29, 2020, at 15:36:23, Carl Hoefs via Cocoa-dev 
>  wrote:
>> 
>> When I issue NSTimer's +timerWithTimeInterval: method, I'm getting 
>> unexpected timer firing times (20X faster than expected).
>> 
>> ∙ If I specify 1.0 for the time interval, my method gets called 20 
>> times/sec. 
>> ∙ If I specify 20.0 for the time interval, my method gets called 1 time/sec.
>> ∙ If I specify 100.0 for the time interval, my method gets called 5 
>> times/sec.
>> ...etc.
>> 
>> Here is my only invocation, called once and nevermore:
>> 
>>   NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
>> 1/sec
>>   target:self
>> selector:@selector(newData:)
>> userInfo:nil
>>  repeats:YES];
>>   [[NSRunLoop mainRunLoop] addTimer:newTimer 
>> forMode:NSRunLoopCommonModes];
> 
> Sounds like multiple timers are being installed. Set a breakpoint that logs 
> when hit.
> 

On break, It's always the same timer. This is with time interval set to 20.0:


<__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:40 2020
<__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:41 2020
<__NSCFTimer: 0x6323c600>   1.00   Wed Apr 29 13:50:42 2020
. . .

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTimer +timerWithTimeInterval:

2020-04-29 Thread Carl Hoefs via Cocoa-dev
When I issue NSTimer's +timerWithTimeInterval: method, I'm getting 
unexpected timer firing times (20X faster than expected).

∙ If I specify 1.0 for the time interval, my method gets called 20 times/sec. 
∙ If I specify 20.0 for the time interval, my method gets called 1 time/sec.
∙ If I specify 100.0 for the time interval, my method gets called 5 times/sec.
...etc.

Here is my only invocation, called once and nevermore:

NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0  // should be 
1/sec
target:self
  selector:@selector(newData:)
  userInfo:nil
   repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:newTimer 
  forMode:NSRunLoopCommonModes];

How can this be?  NSTimeInterval is supposed to be in seconds!

From the Apple documentation:

+ (NSTimer 
 
*)timerWithTimeInterval:(NSTimeInterval 
)ti
 
target:(id)aTarget 
  selector:(SEL)aSelector 
  userInfo:(id)userInfo 
   repeats:(BOOL)yesOrNo;
Parameters
ti
The number of seconds between firings of the timer. If ti is less than or equal 
to 0.0, this method chooses the nonnegative value of 0.0001 seconds instead. A 
NSTimeInterval value is always specified in seconds; it yields sub-millisecond 
precision over a range of 10,000 years.

I can accommodate this odd behavior in my code, but something's gotta be 
wrong...
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thunderbolt port audio programmability

2020-03-20 Thread Carl Hoefs via Cocoa-dev
Thanks for all the helpful insights and links.

At this point, I'm using Audio Units in my iOS test app. I can generate signals 
of specific type, frequency and amplitude. That was the easy part...

However, a hard requirement is that the app must generate what amounts to 
'DC-offset' signals (fully offset from the X-axis). Specifically, for a set 
period of time, the signal needs to be offset fully above the X-axis (a fully 
'positive' signal), and then for a set period of time be offset fully below the 
X-axis (fully 'negative'). This cyclic pattern repeats indefinitely. (Yes, 
strictly speaking, these aren't 'audio' signals any longer; they're actually 
biological stem-cell stimulation signals.)

I generate the AU waveform data according to:
  sample = (sin(theta) * amplitude/2) + amplitude/2; // e.g., sine wave offset 
positive
  sample = (sin(theta) * amplitude/2) - amplitude/2; // e.g., sine wave offset 
negative
...and I've verified that this results in the correct offset values in the AU 
buffer. But when the AU subsystem renders this data, it ignores the offset and 
generates a "corrected" X-axis-centered audio signal anyway, which is useless 
for my purpose.

Is this sort of thing possible to do with Audio Units? AVFoundation?

-Carl


> On Mar 17, 2020, at 10:19 PM, Jens Alfke  wrote:
> 
> If you want to make more than sine waves, there are a bunch of open source 
> audio libraries/programs for generating arbitrarily fancy waveforms — CSound, 
> Pure Data, Max, Supercollider... These are usually used for music synthesis, 
> but most of them let you do general purpose DSP type stuff. And of course 
> they handle the audio output too.
> 
> https://en.wikipedia.org/wiki/Comparison_of_audio_synthesis_environments 
> 
> 
> —Jens

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thunderbolt port audio programmability

2020-03-12 Thread Carl Hoefs via Cocoa-dev

> On Mar 12, 2020, at 11:13 AM, Jens Alfke  wrote:
> 
> 
>> On Mar 12, 2020, at 10:27 AM, Carl Hoefs via Cocoa-dev 
>> mailto:cocoa-dev@lists.apple.com>> wrote:
>> 
>> I'm looking at creating an iPhone/iPad app that acts as a dual-channel 
>> waveform generator. 
>> 
>> I see two options for the output signal medium: 
>> (a) using the audio jack (on suitable devices), or 
>> (b) using the Thunderbolt port
> 
> Wait … you mean Lightning, right? That's the dock connector on iOS devices. 
> Thunderbolt is a super-high-speed data connection on Macs.
> 
> On devices without a headphone jack, you can use the $10 dongle that plugs 
> into the Lightning connector and has a headphone jack on the other end.

[Yes, I meant Lightning. But since it's a serial digital bus, it won't be able 
to issue the generated waveform signals directly, so the audio port would seem 
to be the way to go.]

In iOS, what is the current way to generate precise audio tones? AVFoundation? 
CoreAudio? AudioUnits?

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Thunderbolt port audio programmability

2020-03-12 Thread Carl Hoefs via Cocoa-dev
I'm looking at creating an iPhone/iPad app that acts as a dual-channel waveform 
generator. 

I see two options for the output signal medium: 
 (a) using the audio jack (on suitable devices), or 
 (b) using the Thunderbolt port

Q: Is there a Cocoa framework for programming the Thunderbolt port? Can it 
output raw frequencies or does it function as a serial data port only?

Q: Is there a Cocoa framework for generating sine/square/triangle waves at 
precise frequencies and output currents (0.1-1000Hz, 50-500ua)?

Thx!
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWorkspace notifications related to time change

2019-12-18 Thread Carl Hoefs via Cocoa-dev
On Dec 18, 2019, at 12:39 PM, Jean-Daniel  wrote:
> 
>> Le 18 déc. 2019 à 20:10, Carl Hoefs via Cocoa-dev > <mailto:cocoa-dev@lists.apple.com>> a écrit :
>> 
>>> On Dec 18, 2019, at 11:35 AM, James Walker via Cocoa-dev 
>>> mailto:cocoa-dev@lists.apple.com>> wrote:
>>> 
>>> On 12/18/19 9:55 AM, Carl Hoefs via Cocoa-dev wrote:
>>> 
>>>> However, I cannot get this notification to fire on system time changes. My 
>>>> other notifications (such as sleep wake, etc) do fire.
>>>> -Carl
>>>>[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
>>>>selector: @selector(systemTimeChanged:)
>>>>name: NSSystemClockDidChangeNotification object: NULL];
>>>> -(void) systemTimeChanged: (NSNotification *) notification
>>>> {
>>>>NSLog(@"-systemTimeChanged: %@", [notification name]);
>>>> }
>>> 
>>> I'm not sure what that workspace notification center is for.  Maybe try 
>>> [NSNotificationCenter defaultCenter].
>> 
>> 
>> Thanks for the suggestion. Apple docs have [[[NSWorkspace sharedWorkspace] 
>> notificationCenter] in their code snippets. But [NSNotificationCenter 
>> defaultCenter] doesn't work either. Very odd. Might there be some way in 
>> Xcode or Console to see what notifications are being fired?
>> 
> 
> Workspace Notification Center is only for workspace specific notifications. 
> All other notifications are send on the default Notification Center only.
> 
> I just did test, and I properly receive notifications on each time change in 
> the System preferences.

Argh, I ran my test incorrectly... I just now verified that using 
[NSNotificationCenter defaultCenter] works for both 
NSSystemClockDidChangeNotification and NSSystemTimeZoneDidChangeNotification, 
as it should. 

But Workspace notifications, like NSWorkspaceWillSleepNotification and 
NSWorkspaceDidWakeNotification require [[NSWorkspace sharedWorkspace] 
notificationCenter]. Makes sense.


> On Dec 18, 2019, at 2:18 PM, Jens Alfke  wrote:
> 
> If you add an observer with a notification name and object of nil, it will 
> receive all notifications sent to that center.

That's very handy to know!

Thanks to all!
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWorkspace notifications related to time change

2019-12-18 Thread Carl Hoefs via Cocoa-dev
On Dec 18, 2019, at 12:31 PM, Jean-Daniel via Cocoa-dev 
 wrote:
> 
> 
>> Le 18 déc. 2019 à 18:25, Steve Mills via Cocoa-dev 
>>  a écrit :
>> 
>>> On Dec 18, 2019, at 11:19, Carl Hoefs via Cocoa-dev 
>>>  wrote:
>>> 
>>> I have a macOS daemon that uses NSTimers for scheduling user event 
>>> reminders. 
>>> 
>>> This works well except for abrupt time changes:
>>> (1) the user explicitly changes the date/time
>>> (2) the user crosses into a different time zone
>>> (3) daylight saving time comes/goes. 
>>> Then I need to recalculate the timers based on the new current time.
>>> 
>>> The Apple docs don't list any NSWorkspace notifications related to the 
>>> above. 
>>> How can I handle these cases?
>> 
>> Look in a different header, one related to time; NSDate.h, where you’ll find 
>> NSSystemClockDidChangeNotification.
>> 
>> Steve via iPhone
> 
> 
> Note that 2 and 3 are not time change from the system point of view. The 
> system clock don’t change in such cases.
> 
> You may have some luck with NSSystemTimeZoneDidChangeNotification though (as 
> daylight saving time is usually considered a change of timezone).

Didn't know about NSSystemTimeZoneDidChangeNotification, but I get no 
notification with it either.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWorkspace notifications related to time change

2019-12-18 Thread Carl Hoefs via Cocoa-dev



> On Dec 18, 2019, at 11:35 AM, James Walker via Cocoa-dev 
>  wrote:
> 
> On 12/18/19 9:55 AM, Carl Hoefs via Cocoa-dev wrote:
> 
>> However, I cannot get this notification to fire on system time changes. My 
>> other notifications (such as sleep wake, etc) do fire.
>> -Carl
>> [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
>> selector: @selector(systemTimeChanged:)
>> name: NSSystemClockDidChangeNotification object: NULL];
>> -(void) systemTimeChanged: (NSNotification *) notification
>> {
>> NSLog(@"-systemTimeChanged: %@", [notification name]);
>> }
> 
> I'm not sure what that workspace notification center is for.  Maybe try 
> [NSNotificationCenter defaultCenter].


Thanks for the suggestion. Apple docs have [[[NSWorkspace sharedWorkspace] 
notificationCenter] in their code snippets. But [NSNotificationCenter 
defaultCenter] doesn't work either. Very odd. Might there be some way in Xcode 
or Console to see what notifications are being fired?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSWorkspace notifications related to time change

2019-12-18 Thread Carl Hoefs via Cocoa-dev


> On Dec 18, 2019, at 10:25 AM, Steve Mills via Cocoa-dev 
>  wrote:
> 
>> On Dec 18, 2019, at 11:19, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> I have a macOS daemon that uses NSTimers for scheduling user event 
>> reminders. 
>> 
>> This works well except for abrupt time changes:
>> (1) the user explicitly changes the date/time
>> (2) the user crosses into a different time zone
>> (3) daylight saving time comes/goes. 
>> Then I need to recalculate the timers based on the new current time.
>> 
>> The Apple docs don't list any NSWorkspace notifications related to the 
>> above. 
>> How can I handle these cases?
> 
> Look in a different header, one related to time; NSDate.h, where you’ll find 
> NSSystemClockDidChangeNotification.

Thanks for the tip!

However, I cannot get this notification to fire on system time changes. My 
other notifications (such as sleep wake, etc) do fire.

-Carl


[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self
selector: @selector(systemTimeChanged:)
name: NSSystemClockDidChangeNotification object: NULL];


-(void) systemTimeChanged: (NSNotification *) notification
{
NSLog(@"-systemTimeChanged: %@", [notification name]);
}


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSWorkspace notifications related to time change

2019-12-18 Thread Carl Hoefs via Cocoa-dev
I have a macOS daemon that uses NSTimers for scheduling user event reminders. 

This works well except for abrupt time changes:
  (1) the user explicitly changes the date/time
  (2) the user crosses into a different time zone
  (3) daylight saving time comes/goes. 
Then I need to recalculate the timers based on the new current time.

The Apple docs don't list any NSWorkspace notifications related to the above. 
How can I handle these cases?

-Carl

macOS Mojave 10.14.6, ObjC+Cocoa, Xcode 11.2.1
___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UIView block-based methods

2019-11-11 Thread Carl Hoefs via Cocoa-dev
On Nov 11, 2019, at 9:46 AM, David Duncan  wrote:
> 
>> On Nov 9, 2019, at 12:09 PM, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> I'm trying to keep some older iOS code going, but I'm getting a deprecation 
>> warning on many UIView class methods:
>> 
>> +beginAnimations:context:
>> +setAnimationBeginsFromCurrentState:
>> +setAnimationDuration:
>> +commitAnimations
>> etc.
>> 
>> Xcode 11.2.1 says: "'beginAnimations:context:' is deprecated: first 
>> deprecated in iOS 13.0 - Use the block-based animation API instead"
>> 
>> What is this 'block-based animation API’?
> 
> +[UIView animateWithDuration:animations:] and the like. 

That works perfectly!
Thanx!
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UIView block-based methods

2019-11-09 Thread Carl Hoefs via Cocoa-dev
I'm trying to keep some older iOS code going, but I'm getting a deprecation 
warning on many UIView class methods:

+beginAnimations:context:
+setAnimationBeginsFromCurrentState:
+setAnimationDuration:
+commitAnimations
etc.

Xcode 11.2.1 says: "'beginAnimations:context:' is deprecated: first deprecated 
in iOS 13.0 - Use the block-based animation API instead"

What is this 'block-based animation API'?
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Need for Swift

2019-10-14 Thread Carl Hoefs via Cocoa-dev

> On Oct 12, 2019, at 9:24 AM, Charles Srstka via Cocoa-dev 
>  wrote:
> 
>> On Oct 12, 2019, at 10:55 AM, Pier Bover via Cocoa-dev 
>>  wrote:
>> 
>> Yeah I think Apple saw Obj-C as a barrier for developer adoption. I don't
>> think that's too far from the truth considering the emphasis on teaching
>> Swift to young devs, Playgrounds, the marketing about teenagers making
>> their first app, etc.
>> 
>> Swift has its quirks but most people around me prefer it over Obj-C too,
>> even experienced devs. From StackOverflow trends and other metrics as soon
>> as Swift was announced the popularity of Obj-C declined steadily even when
>> it was clear Swift was still not ready for production:
>> 
>>  - https://www.tiobe.com/tiobe-index/objective-c/ 
>> 
>>  - https://insights.stackoverflow.com/trends?tags=objective-c 
>> 
> Swift’s first few versions were awful, but the community has been very 
> responsive in responding to developer feedback and what we have now is really 
> quite a nice language, possibly the nicest I’ve used. The string nil checks, 
> in particular, are something I’ve become a believer in, especially when 
> spending a bunch of time trying to debug an issue while writing projects in 
> other languages that turns out to be a nil showing up somewhere where we 
> didn’t expect it.
> 
> The main quibble I have with it is the Objective-C bridge, which contains 
> much more magic than I’d prefer, and of course certain legacy issues that 
> come along with having to use the Objective-C frameworks (hello, autorelease 
> pools). When writing cross-platform code on Linux or something, these 
> complaints are of course moot. I hope they release a Windows version at some 
> point; I’d really like to see Swift gain more acceptance as a general-purpose 
> programming language.



With respect to Swift/Obj-C preference, I think it may ultimately come down to 
a mindset issue.

I see Computer Science students here falling into two groups. The group that 
likes Swift generally likes scripting languages, Python, and the like. The 
group that likes Obj-C sees Swift as being "arbitrarily syntactical" with the 
syntax of the language getting in the way of programming. (There is a third 
group that likes both languages, but it is very small.)

I can understand where both camps are coming from. A psychologist explained 
this difference in orientation as one of "convergent vs divergent" thinking, 
and most people are mostly one way or the other.

-Carl
 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Thoughts on Cocoa

2019-10-02 Thread Carl Hoefs via Cocoa-dev



> On Oct 2, 2019, at 10:43 AM, Richard Charles via Cocoa-dev 
>  wrote:
> 
> 
>> On Oct 2, 2019, at 11:14 AM, Turtle Creek Software via Cocoa-dev 
>>  wrote:
>> 
>> Sadly, we just decided to abandon the Cocoa update for our app.
> 
> Great historical overview from a small developers perspective. Perhaps you 
> should send this email to Tim Cook. It might some attention. Just a thought.
> 

Not likely... The Apple people I know say that Tim Cook is John Sculley II. Why 
do you think Jony Ive left?
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Displaying an "album of images" in iOS

2019-09-19 Thread Carl Hoefs via Cocoa-dev
Turns out there's an iCarousel framework that provides Cover Flow functionality.

https://github.com/nicklockwood/iCarousel 
<https://github.com/nicklockwood/iCarousel>

Thanks to all!
-Carl



> On Sep 19, 2019, at 4:48 PM, Carl Hoefs via Cocoa-dev 
>  wrote:
> 
> Yes! Coverflow! That was the name of it!
> 
> Thanks for the pointer.
> -Carl
> 
>> On Sep 19, 2019, at 4:45 PM, Steve Mills via Cocoa-dev 
>>  wrote:
>> 
>>> On Sep 19, 2019, at 18:22, Carl Hoefs via Cocoa-dev 
>>>  wrote:
>>> 
>>> I'm writing an iPhone app that analyzes an input image and generates nine 
>>> jpg images. That's too many to be displayed at once on the GUI, so I 
>>> thought to use an "album of images" that the user can thumb through (an 
>>> animated display that used to be popular years ago on Finder, Safari, 
>>> iTunes, etc). 
>>> 
>>> I can't find how to do this, either because I don't know the correct 
>>> terminology for it, or because it's been deprecated many moons ago. Any 
>>> ideas?
>> 
>> You could use a collection view if you just want a grid of thumbnails. If 
>> you want that coverflow sort of thing, Apple doesn’t supply a class for that 
>> these days, but there are many 3rd party implementations you could check 
>> out. Just search for “iOS coverflow” and I’m sure you’ll find many hits.
>> 
>> Steve via iPad
>> 
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>> 
>> This email sent to newsli...@autonomy.caltech.edu
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Displaying an "album of images" in iOS

2019-09-19 Thread Carl Hoefs via Cocoa-dev
Yes! Coverflow! That was the name of it!

Thanks for the pointer.
-Carl

> On Sep 19, 2019, at 4:45 PM, Steve Mills via Cocoa-dev 
>  wrote:
> 
>> On Sep 19, 2019, at 18:22, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> I'm writing an iPhone app that analyzes an input image and generates nine 
>> jpg images. That's too many to be displayed at once on the GUI, so I thought 
>> to use an "album of images" that the user can thumb through (an animated 
>> display that used to be popular years ago on Finder, Safari, iTunes, etc). 
>> 
>> I can't find how to do this, either because I don't know the correct 
>> terminology for it, or because it's been deprecated many moons ago. Any 
>> ideas?
> 
> You could use a collection view if you just want a grid of thumbnails. If you 
> want that coverflow sort of thing, Apple doesn’t supply a class for that 
> these days, but there are many 3rd party implementations you could check out. 
> Just search for “iOS coverflow” and I’m sure you’ll find many hits.
> 
> Steve via iPad
> 
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Displaying an "album of images" in iOS

2019-09-19 Thread Carl Hoefs via Cocoa-dev
I'm writing an iPhone app that analyzes an input image and generates nine jpg 
images. That's too many to be displayed at once on the GUI, so I thought to use 
an "album of images" that the user can thumb through (an animated display that 
used to be popular years ago on Finder, Safari, iTunes, etc). 

I can't find how to do this, either because I don't know the correct 
terminology for it, or because it's been deprecated many moons ago. Any ideas?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Screensaver icon ?

2019-09-17 Thread Carl Hoefs via Cocoa-dev
Ah, so is this the reason Quartz Composer compositions (*.qtz) won't run as 
screen savers in Mojave?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSLog displays inconsistent format for NSDate

2019-08-31 Thread Carl Hoefs via Cocoa-dev


> On Aug 31, 2019, at 2:51 AM, Allan Odgaard via Cocoa-dev 
>  wrote:
> 
> On 31 Aug 2019, at 2:49, Carl Hoefs via Cocoa-dev wrote:
> 
>> Same result if I run it as a system daemon. So as you suggest it seems there 
>> could be some sort of environment sensitivity going on. If only I knew what 
>> env var to set in the shell... UTC really isn't what I'm looking for.
> 
> The issue appears to be that `NSLog` sends your format string and arguments 
> to the unified logging system, this is what Xcode and Console displays, and 
> here you get dates formatted using the local time zone.
> 
> But it *also* does a simple `stringWithFormat:` and sends the result to 
> standard error, at least when running in a terminal. This is where you are 
> seeing a more crude formatting of the date which is not adjusted to the local 
> time zone.
> 
> Open a new tab in your terminal, in that tab run this command:
> 
>   log stream|grep 'Configured date'
> 
> Now run your executable, and in the tab where it is running, you should see 
> the UTC date, but in the tab where you are watching the log stream, you get 
> the local date.
> ___
> 

Thanks for the input! 

I realized this is occurring because I'm allowing macOS to generate the date 
string according to its whims. If I do the string generation, then I can get 
consistent results. So I added the following line to my code:

NSString *dateString = [NSDateFormatter 
localizedStringFromDate:configuredDate dateStyle:NSDateFormatterFullStyle 
timeStyle:NSDateFormatterLongStyle];

and now I get a standardized string I can at least can live with, valid for all 
situations:

Configured date: Saturday, August 31, 2019 at 3:55:02 PM PDT

-Carl

P.S.: NSDateFormatter & friends are, shall I say, squirrelly beasts, best left 
undisturbed, hiding under the rock ...

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSLog displays inconsistent format for NSDate

2019-08-30 Thread Carl Hoefs via Cocoa-dev
Outside of Xcode, when I run the program (a "Command line tool") directly from 
the bash shell, it prints out in UTC "unixy" format:

2019-08-31 01:00:01 +

...but at the same time it gets logged in the Console log as:

Fri Aug 30 18:00:01 2019

Same result if I run it as a system daemon. So as you suggest it seems there 
could be some sort of environment sensitivity going on. If only I knew what env 
var to set in the shell... UTC really isn't what I'm looking for.

-Carl


> On Aug 30, 2019, at 5:20 PM, Uli Kusterer  
> wrote:
> 
> Wildly guessing here, but could be that NSLog uses different implementations 
> depending on how it was launched. It could be using os_log() under the hood, 
> which doesn't necessarily format all parameters right away, but rather just 
> sends them to the logging system, which then formats it?
> 
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
> 
>> On 20. Aug 2019, at 21:50, Carl Hoefs via Cocoa-dev 
>>  wrote:
>> 
>> When printing out an NSDate using NSLog from within Xcode I get:
>> 
>> "Tue Aug 20 12:32:40 2019"
>> 
>> When the same program is run from within a shell (bash) window:
>> 
>> "2019-08-20 19:32:48 +"
>> 
>> Is the NSDate output format somehow determined by the environment? My system 
>> is set to Local Time Zone (America/Los_Angeles (PDT) offset -25200 
>> (Daylight)).
>> 
>> A code snippet that reproduces the issue follows. 
>> 
>> -Carl
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSLog displays inconsistent format for NSDate

2019-08-20 Thread Carl Hoefs via Cocoa-dev
When printing out an NSDate using NSLog from within Xcode I get:

"Tue Aug 20 12:32:40 2019"

When the same program is run from within a shell (bash) window:

"2019-08-20 19:32:48 +"

Is the NSDate output format somehow determined by the environment? My system is 
set to Local Time Zone (America/Los_Angeles (PDT) offset -25200 (Daylight)).

A code snippet that reproduces the issue follows. 

-Carl



- (void) testDate
{
NSCalendar *calendar = [NSCalendar currentCalendar];
unsigned unitFlags = 
NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay|NSCalendarUnitHour|NSCalendarUnitMinute|NSCalendarUnitSecond|NSCalendarUnitTimeZone;
NSDateComponents *dateComponents = [calendar components:unitFlags 
fromDate:[NSDate date]];
dateComponents.timeZone = NSTimeZone.localTimeZone;
NSDate *configuredDate = [calendar dateFromComponents:dateComponents];
NSLog(@"Configured date: %@",configuredDate);
}

Xcode:
2019-08-20 12:32:40.828863-0700 tester[3926:1353] Configured date: Tue Aug 20 
12:32:40 2019

Shell:
2019-08-20 12:33:08.356 tester[3928:1359] Configured date: 2019-08-20 19:32:48 
+

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Is the list alive?

2019-05-29 Thread Carl Hoefs via Cocoa-dev



> On May 29, 2019, at 6:02 AM, Steve Mills via Cocoa-dev 
>  wrote:
> 
> On May 28, 2019, at 19:46:26, Leo via Cocoa-dev  
> wrote:
>> 
>> 
>> Hmm... my earlier message today never got through.
> 
> Supposedly, these lists are to be done away with at some point. Someone 
> started co...@apple-dev.groups.io, which many of us have moved to. Or use the 
> annoying and inferior dev forums.developer.apple.com.

Note sure if all the bugs are worked out yet... I signed up with 
apple-dev.groups.io  but my emails keep bouncing. 
I go to the web page and have to click a "stop bouncing my emails" button. Then 
it goes back to bouncing again...

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Crashing in NSTabView

2019-05-22 Thread Carl Hoefs


> On May 22, 2019, at 11:31 AM, Daniel DeCovnick  wrote:
> 
> You can always subclass, turn off ARC for that file, and override -release or 
> -autorelease to breakpoint in.

How does one turn off ARC for a specific file?
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Moving cells in a UITableView

2019-05-17 Thread Carl Hoefs
Is this a bug, or is it documented behavior?

Without the following setting:

self.tableView.autoresizingMask |= UIViewAutoresizingFlexibleWidth;

a UITableView won't permit reordering of the table's cells.

-Carl


> On May 16, 2019, at 8:38 PM, Carl Hoefs  
> wrote:
> 
> The problem boils down to this: If a UITableView doesn't have inner-width 
> autoresizing enabled, the table won't get the 'move row' ability.
> 
> Q: How can I set this property on the UITableView programmatically?
> 
> -Carl
> 
> 
>> On May 16, 2019, at 2:29 PM, Carl Hoefs  
>> wrote:
>> 
>> iOS 12.2
>> 
>> I want to allow the user of my iPhone app to finger-reorder the rows in a 
>> UITableView.
>> 
>> I set tableView.editing=YES, and I receive 2 callbacks for each row in the 
>> table:
>> 
>> (1) -tableView:editingStyleForRowAtIndexPath: --> return 
>> UITableViewCellEditingStyleNone.
>> (2) -tableView:canMoveRowAtIndexPath: --> return YES.
>> 
>> (The table displays rows that are shifted to the right to allow for an 
>> editing icon (insert/delete), but as I am reordering rows, there's no icon 
>> displayed.)
>> 
>> I cannot move the rows in the table.
>> The callback -tableView:moveRowAtIndexPath:toIndexPath: does not get called.
>> 
>> My code used to work pre-iOS 12. Am I using the wrong 
>> UITableViewCellEditingStyle?
>> 
>> -Carl
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>> 
>> This email sent to newsli...@autonomy.caltech.edu
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Moving cells in a UITableView

2019-05-16 Thread Carl Hoefs
The problem boils down to this: If a UITableView doesn't have inner-width 
autoresizing enabled, the table won't get the 'move row' ability.

Q: How can I set this property on the UITableView programmatically?

-Carl


> On May 16, 2019, at 2:29 PM, Carl Hoefs  
> wrote:
> 
> iOS 12.2
> 
> I want to allow the user of my iPhone app to finger-reorder the rows in a 
> UITableView.
> 
> I set tableView.editing=YES, and I receive 2 callbacks for each row in the 
> table:
> 
> (1) -tableView:editingStyleForRowAtIndexPath: --> return 
> UITableViewCellEditingStyleNone.
> (2) -tableView:canMoveRowAtIndexPath: --> return YES.
> 
> (The table displays rows that are shifted to the right to allow for an 
> editing icon (insert/delete), but as I am reordering rows, there's no icon 
> displayed.)
> 
> I cannot move the rows in the table.
> The callback -tableView:moveRowAtIndexPath:toIndexPath: does not get called.
> 
> My code used to work pre-iOS 12. Am I using the wrong 
> UITableViewCellEditingStyle?
> 
> -Carl
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Moving cells in a UITableView

2019-05-16 Thread Carl Hoefs
iOS 12.2

I want to allow the user of my iPhone app to finger-reorder the rows in a 
UITableView.

I set tableView.editing=YES, and I receive 2 callbacks for each row in the 
table:

(1) -tableView:editingStyleForRowAtIndexPath: --> return 
UITableViewCellEditingStyleNone.
(2) -tableView:canMoveRowAtIndexPath: --> return YES.

(The table displays rows that are shifted to the right to allow for an editing 
icon (insert/delete), but as I am reordering rows, there's no icon displayed.)

I cannot move the rows in the table.
The callback -tableView:moveRowAtIndexPath:toIndexPath: does not get called.

My code used to work pre-iOS 12. Am I using the wrong 
UITableViewCellEditingStyle?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting the tag of an NSCell

2019-03-16 Thread Carl Hoefs
Subclassing worked perfectly!
Thanks Rob!

-Carl


> On Mar 16, 2019, at 6:08 PM, Rob Petrovec  wrote:
> 
> If you want to use tags, you should subclass NSImageCell and implement -tag & 
> -setTag: to return your own ivar.  Hope that helps.
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Setting the tag of an NSCell

2019-03-16 Thread Carl Hoefs
Thanks Howard and Rob. I will try both approaches and see what works best.

But, it makes me wonder how Xcode is able to set the tag of NSCells?

-Carl


> On Mar 16, 2019, at 6:10 PM, Howard Moon  wrote:
> 
> Either use NSActionCell, or derive your own class from NSCell and implement 
> it.


> On Mar 16, 2019, at 6:08 PM, Rob Petrovec  wrote:
> 
> This is expected and documented behavior.  From 
> https://developer.apple.com/documentation/appkit/nscell/1532348-tag?language=objc
> 
> Setting the value of this property raises with 
> NSInternalInconsistencyException. Subclasses are expected to override this 
> property if they support tags
> 
> If you want to use tags, you should subclass NSImageCell and implement -tag & 
> -setTag: to return your own ivar.  Hope that helps.
> 
> —Rob
> 
> 
>> On Mar 16, 2019, at 7:03 PM, Carl Hoefs  
>> wrote:
>> 
>> macOS 10.12, ObjC
>> 
>> Is it not possible to set the tag of an NSImageCell at runtime? 
>> 
>> At runtime when I do "myCell.tag = val;" I get a warning:  
>>   Stub implementation of -setTag by NSCell does nothing.
>> 
>> I have an array of 48 NSImageCells. I can't hard-code them in Xcode because 
>> don't know the tag values until runtime.
>> How can I accomplish this? 
>> 
>> -Carl
>> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Setting the tag of an NSCell

2019-03-16 Thread Carl Hoefs
macOS 10.12, ObjC

Is it not possible to set the tag of an NSImageCell at runtime? 

At runtime when I do "myCell.tag = val;" I get a warning:  
   Stub implementation of -setTag by NSCell does nothing.

I have an array of 48 NSImageCells. I can't hard-code them in Xcode because 
don't know the tag values until runtime.
How can I accomplish this? 

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions regarding the sandbox in iOS

2019-02-05 Thread Carl Hoefs

> On Feb 5, 2019, at 6:38 PM, Saagar Jha  wrote:
> 
> FYI, iOS apps start with their working directory set to “/“ (but don’t depend 
> on this!), so trying to write there is going to fail.

Yes, the writes to / do appear to fail.

> NSHomeDirectory is an easy way to get your sandbox root, but you should 
> probably be using the options the others have mentioned.

Of NSHomeDirectory, NSDocumentDirectory, and NSLibraryDirectory, I'm currently 
using NSDocumentLibrary for the scratch directory. I presume for each of these 
areas, the storage is persistent across app invocations. Is there a temporary 
area available for use? 

-Carl


> 
> Regards,
> Saagar Jha
> 
>> On Feb 4, 2019, at 19:30, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> iOS 12
>> 
>> Q1. In general, is an iOS app expected to determine the sandbox path to 
>> manage its files? 
>> 
>> Q2. Does the sandbox behave like the "current working directory" default on 
>> macOS? (i.e., if a function writes out a file to just "filename" with no 
>> path, does it get written automatically to the sandbox?)
>> 
>> Q3. What is the proper way to determine the app sandbox path? Is there an 
>> app-wide runtime global?
>> 
>>NSString *sandbox = 
>> [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)
>>  lastObject];
>> 
>> -Carl
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto: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 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
>> 
>> This email sent to saa...@saagarjha.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions regarding the sandbox in iOS

2019-02-05 Thread Carl Hoefs


> On Feb 5, 2019, at 10:30 AM, Jens Alfke  wrote:
> 
>> On Feb 5, 2019, at 9:25 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> The reason for the specific sandbox questions is that my iOS app needs to 
>> call 3rd-party functions, some of which create temp files "in place" - as if 
>> they did an fopen("filename.ext","w"). Such temp files appear to be written 
>> "nowhere"... 
> 
> You can set the current directory wherever you want, via the system call 
> chdir(), before calling those functions. 

Yes, chdir(docsSandbox.UTF8String) works perfectly!

Thanks!
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Questions regarding the sandbox in iOS

2019-02-05 Thread Carl Hoefs
The reason for the specific sandbox questions is that my iOS app needs to call 
3rd-party functions, some of which create temp files "in place" - as if they 
did an fopen("filename.ext","w"). Such temp files appear to be written 
"nowhere"... 

I was hoping that the sandbox might work along the lines of the "default 
working directory" concept in macOS. Can anyone shed light on this?

-Carl
 
> On Feb 5, 2019, at 7:02 AM, Alex Zavatone  wrote:
> 
> The sandbox is within the current app.  The app also has access to other 
> shared folders like Music and so on.
> 
>   NSString *appLibraryFolder = 
> [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, 
> YES) objectAtIndex:0];
>   NSString *appDocumentsFolder = 
> [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, 
> YES) objectAtIndex:0];
> 
> 
>> On Feb 4, 2019, at 9:30 PM, Carl Hoefs  
>> wrote:
>> 
>> iOS 12
>> 
>> Q1. In general, is an iOS app expected to determine the sandbox path to 
>> manage its files? 
>> 
>> Q2. Does the sandbox behave like the "current working directory" default on 
>> macOS? (i.e., if a function writes out a file to just "filename" with no 
>> path, does it get written automatically to the sandbox?)
>> 
>> Q3. What is the proper way to determine the app sandbox path? Is there an 
>> app-wide runtime global?
>> 
>>   NSString *sandbox = 
>> [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES)
>>  lastObject];
>> 
>> -Carl
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Questions regarding the sandbox in iOS

2019-02-04 Thread Carl Hoefs
iOS 12

Q1. In general, is an iOS app expected to determine the sandbox path to manage 
its files? 

Q2. Does the sandbox behave like the "current working directory" default on 
macOS? (i.e., if a function writes out a file to just "filename" with no path, 
does it get written automatically to the sandbox?)

Q3. What is the proper way to determine the app sandbox path? Is there an 
app-wide runtime global?

NSString *sandbox = 
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) 
lastObject];

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSImage to JPEG file?

2019-01-16 Thread Carl Hoefs


> On Jan 16, 2019, at 10:43 AM, Jens Alfke  wrote:
> 
>> On Jan 16, 2019, at 8:32 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> It was the NSData tie-in I didn't know. (I was expecting NSImage to have 
>> innate export capabilities
> 
> That would be poor API design. If it had -writeToFile, then it would also 
> need -writeToStream:, -writeToFileHandle:, -writeToFileDescriptor:, 
> -writeToNSURLSessionDataDelegate:, etc.
> Providing the data itself means you can then use existing APIs on other 
> classes to put the data anywhere you want.

But all of that would come "for free" if NSImage inherited from NSData, no?

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSImage to JPEG file?

2019-01-16 Thread Carl Hoefs
Thanks Wim and Gerd. It was the NSData tie-in I didn't know. (I was expecting 
NSImage to have innate export capabilities, but this works too.)

-Carl


> On Jan 16, 2019, at 7:56 AM, Wim Lewis  wrote:
> 
> On Tue, Jan 15, 2019 at 08:10:58PM -0700, Carl Hoefs wrote:
>> Using NSBitmapImageRep, is it possible to write the JPEG representation out 
>> to a .JPG file on disk?
> 
> The normal way is to get the JPEG representation as a NSData and then 
> write that NSData to disk using (e.g.) -writeToFile:options:error:.
> 
> The ImageIO functions allow you to stream the data to disk (instead of 
> creating a complete representation in memory before writing), which can 
> be more efficient, but in my experience this is rarely a concern.
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSImage to JPEG file?

2019-01-15 Thread Carl Hoefs
Using NSBitmapImageRep, is it possible to write the JPEG representation out to 
a .JPG file on disk?

-Carl

> On Jan 15, 2019, at 4:01 PM, Jens Alfke  wrote:
> 
> It’s been a long time since I worked with NSImages, but it’s easy to get a 
> JPEG representation using just plain AppKit. 
> 
> Just look through the representations for an NSBitmapImageRep, then call [rep 
> representationUsingType: NSBitmapImageFileTypeJPEG options: 0].
> 
> —Jens
> 
> PS: _Please_ don’t reply to digests. It messes up the subject line and the 
> message threading.
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UIImagePickerController and 48-bit photos

2019-01-15 Thread Carl Hoefs
I've been tasked with scoping out creating an iPhone app that processes 
"48-bit" images or photos on the newer iPhones. (I unfortunately don't have a 
"newer" iPhone yet to try this out.)

Questions:

- Does the UIImagePickerController paradigm work transparently for such images, 
as it does for normal images? 
- Is there a framework for manipulating such images? AVFoundation?
- Are such 48-bit images/photos in RAW format? TIFF format?

Thanks,
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSImage to JPEG file?

2019-01-14 Thread Carl Hoefs
Got it working!
Thanks, that's the tip I needed. 
-Carl


> On Jan 14, 2019, at 1:26 PM, Vince DeMarco  wrote:
> 
> Use ImageIO.
> 
> create a CGImageDestinationRef and add the CGImage to it.
> 
> Vince
> 
> 
> 
>> On Jan 14, 2019, at 12:17 PM, Carl Hoefs  
>> wrote:
>> 
>> I have a background macOS daemon process (aka Foundation-based "command line 
>> tool") that needs to write out a JPEG file to local disk. The image resides 
>> in an NSImage object (or alternatively, an NSData of raw RGB image data). 
>> 
>> Short of resorting to something like libjpeg, what is the ObjC way to do 
>> this?
>> 
>> -Carl
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/demarco%40apple.com
>> 
>> This email sent to dema...@apple.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSImage to JPEG file?

2019-01-14 Thread Carl Hoefs
I have a background macOS daemon process (aka Foundation-based "command line 
tool") that needs to write out a JPEG file to local disk. The image resides in 
an NSImage object (or alternatively, an NSData of raw RGB image data). 

Short of resorting to something like libjpeg, what is the ObjC way to do this?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSData from dispatch_data_t?

2018-10-30 Thread Carl Hoefs



> On Oct 30, 2018, at 7:49 PM, Greg Parker  wrote:
> 
> NSData *nsdata = (NSData *)data_t;
> 

Yes! That works! (I thought I had tried the explicit cast, but I guess I 
hadn't...)

Thanks!!
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSData from dispatch_data_t?

2018-10-30 Thread Carl Hoefs
It's ugly, but it compiles:

[NSData dataWithBytes:(__bridge const void * _Nullable)(data_t) 
length:dispatch_data_get_size(data_t)];

Thanks!
-Carl


> On Oct 30, 2018, at 7:37 PM, Ryan Dignard  
> wrote:
> 
> To get the size of the dispatch data you can call 
> dispatch_data_get_size(dispatch_data_t) on it which would let you create an 
> NSData object.
> 
> https://developer.apple.com/documentation/dispatch/1452977-dispatch_data_get_size?language=objc
> 
> -Ryan
> 
> On Tue, Oct 30, 2018 at 7:26 PM Carl Hoefs  
> wrote:
> Is it possible to create an NSData object from a dispatch_data_t?
> 
> I'm interfacing to a 3rd party library that returns only a dispatch_data_t 
> object. Once upon a time you could simply cast that to (NSData *) and work 
> with it that way, but Xcode now flags it as an error:
> 
> dispatch_data_t data_t = BGRequestSidebandDL(channel);
> NSData *nsdata = data_t; <<<
> 
> >>> Incompatible pointer types initializing 'NSData *' with an expression 
> of type 'dispatch_data_t' (aka 'NSObject *')
> 
> Nor can I do this:
> NSData *nsdata = [[NSData alloc] initWithBytes:data_t length:size];
> because I don't know the size of the dispatch_data_t returned to me.
> 
> Thx,
> -Carl
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/conceptuallyflawed%40gmail.com
> 
> This email sent to conceptuallyfla...@gmail.com

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSData from dispatch_data_t?

2018-10-30 Thread Carl Hoefs
Is it possible to create an NSData object from a dispatch_data_t?

I'm interfacing to a 3rd party library that returns only a dispatch_data_t 
object. Once upon a time you could simply cast that to (NSData *) and work with 
it that way, but Xcode now flags it as an error:

dispatch_data_t data_t = BGRequestSidebandDL(channel);
NSData *nsdata = data_t; <<<

>>> Incompatible pointer types initializing 'NSData *' with an expression 
of type 'dispatch_data_t' (aka 'NSObject *')

Nor can I do this:
NSData *nsdata = [[NSData alloc] initWithBytes:data_t length:size];
because I don't know the size of the dispatch_data_t returned to me.
 
Thx,
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AirPrint in iOS 11?

2018-05-11 Thread Carl Hoefs
Okay, got it to work. The sample code I had based mine on was too old (WWDC 
'14) . 

Thanks for the link, Alex!
-Carl


> On May 11, 2018, at 5:55 PM, Alex Zavatone <z...@mac.com> wrote:
> 
> I did it a few months ago.  Have you tried the sample code?
> 
> https://developer.apple.com/library/content/samplecode/PrintBanner/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013422
> 
>> On May 11, 2018, at 7:54 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>> wrote:
>> 
>> As an addendum:  I've verified that I can print from the iPhone Photos app 
>> to my printer using AirPrint. The issue is doing it programmatically.
>> 
>> 
>>> On May 11, 2018, at 5:50 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>>> wrote:
>>> 
>>> Is printing from iOS still possible? Is AirPrint still a viable SDK to use? 
>>> 
>>> I can get AirPrint to bring up a printer selection screen, but it won't 
>>> actually select a printer.
>>> 
>>> I present the printer selection screen:
>>> 
>>>  UIPrinterPickerController *printPicker = 
>>> [UIPrinterPickerController 
>>> printerPickerControllerWithInitiallySelectedPrinter:nil];
>>>  [printPicker presentAnimated:YES completionHandler:
>>>^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, 
>>> NSError *error)
>>> {
>>>// . . .
>>> }];
>>> 
>>> By default, this presents a tableview with an entry that says: 
>>> 
>>>  "Printer  Select Printer >"
>>> 
>>> and below, it shows a preview of the image that will be printed. So far, so 
>>> good.
>>> 
>>> If I tap on "Select Printer >" it takes me to a tableview list of the 
>>> available printers. 
>>> If I tap an available printer, it takes me back to the default screen, with 
>>> NO printer selected!
>>> 
>>> The printer is an AirPrint-capable device (Canon), on the local wifi with 
>>> the iPhone. I've implemented all of the 
>>> UIPrintInteractionControllerDelegate callbacks (none of which get called).
>>> 
>>> What is going wrong here? There's nothing in the Xcode log.
>>> 
>>> -Carl
>>> 
>>> ___
>>> 
>>> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>>> 
>>> This email sent to newsli...@autonomy.caltech.edu
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AirPrint in iOS 11?

2018-05-11 Thread Carl Hoefs
Yep. There's not much to go wrong. That's why I can't understand why it doesn't 
select the printer from my app (but Photos can). That part is really out of my 
control. You present the picker and it's supposed to perform the selection. If 
it doesn't, I'm clueless.

-Carl


> On May 11, 2018, at 5:55 PM, Alex Zavatone <z...@mac.com> wrote:
> 
> I did it a few months ago.  Have you tried the sample code?
> 
> https://developer.apple.com/library/content/samplecode/PrintBanner/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013422
> 
>> On May 11, 2018, at 7:54 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>> wrote:
>> 
>> As an addendum:  I've verified that I can print from the iPhone Photos app 
>> to my printer using AirPrint. The issue is doing it programmatically.
>> 
>> 
>>> On May 11, 2018, at 5:50 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>>> wrote:
>>> 
>>> Is printing from iOS still possible? Is AirPrint still a viable SDK to use? 
>>> 
>>> I can get AirPrint to bring up a printer selection screen, but it won't 
>>> actually select a printer.
>>> 
>>> I present the printer selection screen:
>>> 
>>>  UIPrinterPickerController *printPicker = 
>>> [UIPrinterPickerController 
>>> printerPickerControllerWithInitiallySelectedPrinter:nil];
>>>  [printPicker presentAnimated:YES completionHandler:
>>>^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, 
>>> NSError *error)
>>> {
>>>// . . .
>>> }];
>>> 
>>> By default, this presents a tableview with an entry that says: 
>>> 
>>>  "Printer  Select Printer >"
>>> 
>>> and below, it shows a preview of the image that will be printed. So far, so 
>>> good.
>>> 
>>> If I tap on "Select Printer >" it takes me to a tableview list of the 
>>> available printers. 
>>> If I tap an available printer, it takes me back to the default screen, with 
>>> NO printer selected!
>>> 
>>> The printer is an AirPrint-capable device (Canon), on the local wifi with 
>>> the iPhone. I've implemented all of the 
>>> UIPrintInteractionControllerDelegate callbacks (none of which get called).
>>> 
>>> What is going wrong here? There's nothing in the Xcode log.
>>> 
>>> -Carl
>>> 
>>> ___
>>> 
>>> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>>> 
>>> This email sent to newsli...@autonomy.caltech.edu
>> 
>> ___
>> 
>> 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.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AirPrint in iOS 11?

2018-05-11 Thread Carl Hoefs
As an addendum:  I've verified that I can print from the iPhone Photos app to 
my printer using AirPrint. The issue is doing it programmatically.


> On May 11, 2018, at 5:50 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
> wrote:
> 
> Is printing from iOS still possible? Is AirPrint still a viable SDK to use? 
> 
> I can get AirPrint to bring up a printer selection screen, but it won't 
> actually select a printer.
> 
> I present the printer selection screen:
> 
>UIPrinterPickerController *printPicker = 
>   [UIPrinterPickerController 
> printerPickerControllerWithInitiallySelectedPrinter:nil];
>[printPicker presentAnimated:YES completionHandler:
>  ^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, 
> NSError *error)
>   {
>  // . . .
>   }];
> 
> By default, this presents a tableview with an entry that says: 
> 
>"Printer  Select Printer >"
> 
> and below, it shows a preview of the image that will be printed. So far, so 
> good.
> 
> If I tap on "Select Printer >" it takes me to a tableview list of the 
> available printers. 
> If I tap an available printer, it takes me back to the default screen, with 
> NO printer selected!
> 
> The printer is an AirPrint-capable device (Canon), on the local wifi with the 
> iPhone. I've implemented all of the UIPrintInteractionControllerDelegate 
> callbacks (none of which get called).
> 
> What is going wrong here? There's nothing in the Xcode log.
> 
> -Carl
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


AirPrint in iOS 11?

2018-05-11 Thread Carl Hoefs
Is printing from iOS still possible? Is AirPrint still a viable SDK to use? 

I can get AirPrint to bring up a printer selection screen, but it won't 
actually select a printer.

I present the printer selection screen:

UIPrinterPickerController *printPicker = 
   [UIPrinterPickerController 
printerPickerControllerWithInitiallySelectedPrinter:nil];
[printPicker presentAnimated:YES completionHandler:
  ^(UIPrinterPickerController *printerPicker, BOOL userDidSelect, 
NSError *error)
   {
  // . . .
   }];

By default, this presents a tableview with an entry that says: 

"Printer  Select Printer >"

and below, it shows a preview of the image that will be printed. So far, so 
good.

If I tap on "Select Printer >" it takes me to a tableview list of the available 
printers. 
If I tap an available printer, it takes me back to the default screen, with NO 
printer selected!

The printer is an AirPrint-capable device (Canon), on the local wifi with the 
iPhone. I've implemented all of the UIPrintInteractionControllerDelegate 
callbacks (none of which get called).

What is going wrong here? There's nothing in the Xcode log.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Is "-init" really needed?

2017-08-07 Thread Carl Hoefs

> On Aug 7, 2017, at 5:17 PM, じょいすじょん  
> wrote:
> 
>> 
>> On Aug 8, 2017, at 9:09, Jens Alfke  wrote:
>> 
>> 
>>> On Aug 7, 2017, at 5:02 PM, David Hoerl  wrote:
>>> 
>>> But then I though - heck, if Foo has NSObject as its super class, gee, 
>>> maybe -init isn't really need. I mean, if all of Foo's ivars and properties 
>>> are initialized, its a shortcut, right.
>> 
>> -[NSObject init] happens to be a no-op empty method. So if a direct subclass 
>> of NSObject has no -init method of its own, you could get by with just 
>> calling +alloc. However, I think this would be a really bad idea. If at some 
>> point you needed to add an -init method to class Foo, like to initialize an 
>> ivar, you’d have to go and fix all this code that wasn’t calling -init, or 
>> else you’d suddenly have a number of bugs in your code. Even worse, if 
>> someone else added the -init method and didn’t know about this quirk of how 
>> callers initialized Foo, they might have  no idea why their method didn’t 
>> get called. Yuck.
>> 
>> —Jens
>> ___
>> 
> It definitely should never pass in a code review for exactly these reasons 
> and should be fixed by either adding the init call or changing the alloc call 
> to a new call (since new is a synonym for alloc init).
> If you saw it pre-existing in code that was being checked in, require it to 
> be fixed. Refusal to type a few characters is absolutely a shortcut to 
> trouble later (Y2K).
> ___
> 

Is the use of +new discouraged also?

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Single-channel video recording in iOS?

2017-06-23 Thread Carl Hoefs
iOS 10.3.2

I'd like to do monochrome (or single channel red) video recording, but it seems 
iOS does not support this.

According to AVCaptureVideoDataOutput -availableVideoCVPixelFormatTypes, the 
only supported pixel format types available for the iPad Pro in iOS 10.3.2 are:

'420v' - kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange   875704438 
'420f' - kCVPixelFormatType_420YpCbCr8BiPlanarFullRange875704422
'BGRA' - kCVPixelFormatType_32BGRA970369

...but these can result in very large (~1GB) video files, and require 
post-processing to remove the unneeded channel data. 

Attempted use of other formats, such as kCVPixelFormatType_1Monochrome, 
kCVPixelFormatType_32AlphaGray, kCVPixelFormatType_16Gray, or 
kCVPixelFormatType_OneComponent8 result in an "Unsupported pixel format type" 
exception at runtime.

Is there another way to accomplish this? iOS 11?

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Carl Hoefs

> On Jun 23, 2017, at 11:58 AM, Jens Alfke <j...@mooseyard.com> wrote:
> 
>> On Jun 23, 2017, at 10:22 AM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>>  At this high frame rate, I'm expecting that callbacks would not be able to 
>> keep up in real time without an unacceptably high rate of dropped frames.
>> Having the encryption integrated within the capture / movie file chain would 
>> be ideal (perhaps implemented by utilizing the iPhone's GPU to keep up 
>> pace), but it doesn't sound like iOS supports it at this point.
> 
> I don’t think there’d be any noticeable difference in performance. Why do you 
> think an app-defined callback would be that much slower than an OS-provided 
> one?

Whenever we've tried implementing our own real-time video callbacks, the frame 
rate drops to about 10 fps. That was a couple of years ago; I could revisit the 
issue.

> I could argue that adding a second level of encryption is pointless, but I 
> know that HIPAA has some strict regulations, even if they’re not always 
> sensical.

The videos need to be uploaded to a remote server for analysis. HIPAA-wise, I 
don't know if using SSL for file transfer would suffice to avoid the need to 
encrypt the videos on the iPhone. The server currently doesn't do HTTPS.
> 
> (When you encrypt the file you're generating a random IV, then writing the IV 
> at the start of the file, or something like that, right? And the key is 
> stored someplace at least as safe as the Keychain?

The IV is kept separately from the file, in an encrypted database.

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Carl Hoefs

> On Jun 23, 2017, at 11:18 AM, Quincey Morris 
> <quinceymor...@rivergatesoftware.com> wrote:
> 
> On Jun 23, 2017, at 10:51 , Carl Hoefs <newsli...@autonomy.caltech.edu 
> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> it analyses specific processes in the body which are indicative of a certain 
>> pathology
> 
> It scans for developers who type spaces instead of tabs???
> 
I 'encrypted' my meaning, but you read through it like it was plaintext!


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Carl Hoefs

> On Jun 23, 2017, at 10:33 AM, Steve Bird <sb...@culverson.com> wrote:
> 
>> On Jun 23, 2017, at 1:22 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>> wrote:
> 
>> I'm currently recording 1280x720 at 240fps H.264 video on the iPhone
> 
> Just curious - can you tell us what you are recording at 240 fps ?
> 

It's a medical app. It's still under development yet so I can't divulge exactly 
what it's recording, other than to say that it analyses specific processes in 
the body which are indicative of a certain pathology.  :)

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: AVCaptureMovieFileOutput + encryption

2017-06-23 Thread Carl Hoefs

> On Jun 22, 2017, at 11:30 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
>> On Jun 22, 2017, at 5:18 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> Is it possible to add encryption to this chain, so the movie file is written 
>> out encrypted? 
> 
> I’ve never seen any crypto stuff in AVFoundation (but it’s been a few years.) 
> You’ll probably need to hook something in to run your own callbacks, and then 
> write callbacks to do the encryption (e.g. using CommonCrypto or 
> SecTransform.)
> 
> (Warning: It’s easy to shoot yourself in the foot using crypto primitives, 
> and end up with something that’s trivially breakable. For example, most block 
> ciphers like AES have the “fun” property that if you ever encrypt two 
> different messages with the same key and initialization vector, the 
> encryption can be broken by XOR’ing the messages.)
> 
> (Also, IIRC many media formats require random access during playback. Making 
> an encrypted file format with random access capabilities turns out to be 
> annoyingly hard; I had to do it a year or so ago.)

Thanks for your insights.  I'm currently recording 1280x720 at 240fps H.264 
video on the iPhone, then encrypting the video file as a post-recording step 
(using AES256 to be HIPAA-compliant).  At this high frame rate, I'm expecting 
that callbacks would not be able to keep up in real time without an 
unacceptably high rate of dropped frames.

Having the encryption integrated within the capture / movie file chain would be 
ideal (perhaps implemented by utilizing the iPhone's GPU to keep up pace), but 
it doesn't sound like iOS supports it at this point.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


AVCaptureMovieFileOutput + encryption

2017-06-22 Thread Carl Hoefs
iOS 10.3.2

Using AVFoundation, I've set up an AVCaptureSession, and added an 
AVCaptureMovieFileOutput to it. This stores the recorded video in the sandbox 
as a movie file. 

Is it possible to add encryption to this chain, so the movie file is written 
out encrypted? 

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to validate Core Data attributes ? (example in official doc doesn't work)

2017-06-14 Thread Carl Hoefs

> On Jun 14, 2017, at 12:26 AM, Quincey Morris 
>  wrote:
> 
> On Jun 13, 2017, at 23:54 , Glen Huang  wrote:
>> 
>> what do you use instead of Core Data?
> 
> I ended up writing my own object graph framework. Interestingly, many parts 
> of the implementation fell naturally into the same mechanisms Core Data uses 
> (such as having client-facing and primitive versions of the same property.) 
> Unfortunately, because it manipulates the class metadata at runtime, this 
> framework is also fatally stuck in the Obj-C world, and I haven’t found an 
> alternative approach for Swift.
> 
>> Also I don't quite get the "can’t afford the therapy afterwards" part
> 
> I used Core Data for a major project — years ago, around the time Leopard 
> came out — and it was incredibly painful: 6 months of utter misery. It’s one 
> of those magical Apple technology solutions that’s clever as all get-out, but 
> totally inscrutable. Core Data doesn’t fulfill a design that’s documented 
> somewhere, its design is … whatever its implementation does. Sometimes that 
> makes sense, sometimes it doesn’t.
> 
> I think Core Data is great for Apple’s internal use (e.g. in older versions 
> of iTunes/iPhoto/Photos), and perhaps feasible for 3rd party developers if 
> you’re dealing with tens of thousands of objects (for performance reasons). 
> It may have become more usable over the years, but I promised myself I’d 
> never go near it again.

I never understood why they killed off EOF.

-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binary floating point format

2017-03-30 Thread Carl Hoefs

> On Mar 30, 2017, at 9:06 PM, Greg Parker <gpar...@apple.com> wrote:
> 
> 
>> On Mar 30, 2017, at 9:03 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>>> On Mar 30, 2017, at 8:10 PM, Greg Parker <gpar...@apple.com 
>>> <mailto:gpar...@apple.com>> wrote:
>>> 
>>>> On Mar 30, 2017, at 7:09 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>>> 
>>>> 26 C3 E9 E2 6C 6A 38 0C 46 C3 E9 E2 6C 6A 40 0B 46 C3 E9 E2 83 6A DC 0A 66 
>>>> C3 E9 E2 83 6A 0E 0B
>>>> A5 C3 EF E2 AF 6A 40 0B A5 C3 EF E2 C6 6A 40 0B C5 C3 F5 E2 C6 6A 16 0A C5 
>>>> C3 F5 E2 DC 6A 0E 0B
>>>> 26 C3 3C E3 9E 62 B2 09 26 C3 3C E3 9E 62 B2 09 26 C3 36 E3 B4 62 BA 08 06 
>>>> C3 36 E3 CB 62 C2 07
>>>> 45 C4 76 E3 44 6C 38 0C 25 C4 76 E3 5A 6C 06 0C 25 C4 76 E3 5A 6C DC 0A 05 
>>>> C4 7D E3 70 6C DC 0A
>>> 
>>> 
>>> Byte-swapped VAX type D might be right, but it's so easy to be off by a 
>>> factor of 2 here that it's hard to trust any guess.
>>> 
>>> Using CFSwapInt64() from CoreFoundation/CFByteOrder.h and from_vax_d8() 
>>> from https://pubs.usgs.gov/of/2005/1424/ 
>>> <https://pubs.usgs.gov/of/2005/1424/>, your bytes above are:
>>> -41.7215935353
>>> -49.7215935353
>>> -49.7215935353
>>> -49.7215935366
>>> -49.7215935366
>>> -57.7215935366
>>> -57.7215935366
>>> -82.9432328547
>>> -82.9432328547
>>> -82.9432328574
>>> -82.9432328574
>>> -98.9432786338
>>> -98.9432786338
>>> -98.9432786363
>>> -98.9432786363
>>> -41.7219100388
>>> 
>> 
>> Enticing results!  When I use CFSwapInt64(), it does this to the bytes:
>> 
>> - raw bytes: 69BF5DE3 9F530306
>> - swp bytes: 0603539F E35DBF69
>> * [04] time_base: 
>> 2400969845129752384725738662412037010364031309686872696685853017835577483033453697155629104443247189829603912142488904070729903714756009814926441089319983058422454699494905107871645497808138444180815872.00
>>  
>> 
>> The 'time_base' value is what I get when I printf the swapped-bytes value 
>> with a %f formatter.
>> Not sure why you're getting good results...
> 
> CFSwapInt64() is not sufficient. I used CFSwapInt64() followed by 
> from_vax_d8() from the USGS URL above. The latter is what performs the real 
> floating-point format transformation from VAX to IEEE.

Thanks, I overlooked that. CFSwapInt64() + from_vax_d8() don't seem to be able 
to handle the attached byte stream. It does a raise(SIGPFE) at line 540 in 
convert_vax_data.c:

27 C2 36 E3 05 64 85 02 07 C2 3C E3 1C 64 E9 02 07 C2 3C E3 1C 64 22 02 07 C2 
3C E3 32 64 B7 02 E7 C1 3C E3 49 64 85 02

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binary floating point format

2017-03-30 Thread Carl Hoefs

> On Mar 30, 2017, at 8:10 PM, Greg Parker <gpar...@apple.com> wrote:
> 
>> 
>> On Mar 30, 2017, at 7:09 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> 
>>> On Mar 30, 2017, at 6:40 PM, Steve Bird <sb...@culverson.com 
>>> <mailto:sb...@culverson.com>> wrote:
>>> 
>>> 
>>>> On Mar 30, 2017, at 8:25 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>>> 
>>>> I have megabytes of raw legacy science datasets that I'm trying to read 
>>>> into my app and ingest into an array of doubles. The data is supposed to 
>>>> be organized as a stream of 8-byte doubles. I do not know how these 
>>>> datasets were generated, so I don't know what format (big/little endian, 
>>>> byte swapped, etc) they are in. 
>>>> Here is a hex dump of 4 binary doubles:
>>>> 
>>>> 49BF7DE372533C05 A8C02FE3135B4F09 86C22FE37E630B05 27C2C4E3E258BA08
>>> 
>>> A few minutes of LabVIEW work shows some semi-reasonable values if you swap 
>>> bytes:
>>> BF49E37D5372053C = -0.000790058
>>> C0A8E32F5B13094F = -3185.59
>>> 
>>> Do you know that those values are wrong?
>> 
>> Hmm, the -3185.59 doesn't look right. The data is _supposed_ to be:
>> 
>> 1st double:  Time value, monotonically increasing, usually starting near 
>> 0.0
>> 2nd double: Sensor value, oscillating waveform, centered about some 
>> arbitrary value
>> 
>> So I'm expecting data like:
>> 
>> 0.011   0.57525634765625
>> 0.012   0.45166015625000
>> 0.013   0.29907226562500
>> 0.014   0.13275146484375
>> 0.015   -0.03173828125000
>> 0.016   -0.18218994140625
>> 0.017  -0.29602050781250
>> 0.018   -0.38055419921875
>> ...etc.
>> 
>> or even:
>> 
>> 0.0182089.66467285156250
>> 0.0202087.57525634765625
>> 0.0222085.45166015625000
>> 0.0242083.29907226562500
>> 0.0262082.13275146484375
>> 0.0282081.03173828125000
>> 0.0302080.18218994140625
>> 0.0322080.29602050781250
>> 0.0342079.38055419921875
>> 0.0362079.43060302734375
>> 0.0382078.44738769531250
>> 0.0402076.43640136718750
>> ...etc
>> 
>> When I manually swap the bytes in my program, I still end up with invalid 
>> values.
>> -Carl
>> 
>> 26 C3 E9 E2 6C 6A 38 0C 46 C3 E9 E2 6C 6A 40 0B 46 C3 E9 E2 83 6A DC 0A 66 
>> C3 E9 E2 83 6A 0E 0B
>> A5 C3 EF E2 AF 6A 40 0B A5 C3 EF E2 C6 6A 40 0B C5 C3 F5 E2 C6 6A 16 0A C5 
>> C3 F5 E2 DC 6A 0E 0B
>> 26 C3 3C E3 9E 62 B2 09 26 C3 3C E3 9E 62 B2 09 26 C3 36 E3 B4 62 BA 08 06 
>> C3 36 E3 CB 62 C2 07
>> 45 C4 76 E3 44 6C 38 0C 25 C4 76 E3 5A 6C 06 0C 25 C4 76 E3 5A 6C DC 0A 05 
>> C4 7D E3 70 6C DC 0A
> 
> 
> Byte-swapped VAX type D might be right, but it's so easy to be off by a 
> factor of 2 here that it's hard to trust any guess.
> 
> Using CFSwapInt64() from CoreFoundation/CFByteOrder.h and from_vax_d8() from 
> https://pubs.usgs.gov/of/2005/1424/ <https://pubs.usgs.gov/of/2005/1424/>, 
> your bytes above are:
> -41.7215935353
> -49.7215935353
> -49.7215935353
> -49.7215935366
> -49.7215935366
> -57.7215935366
> -57.7215935366
> -82.9432328547
> -82.9432328547
> -82.9432328574
> -82.9432328574
> -98.9432786338
> -98.9432786338
> -98.9432786363
> -98.9432786363
> -41.7219100388
> 

Enticing results!  When I use CFSwapInt64(), it does this to the bytes:

- raw bytes: 69BF5DE3 9F530306
- swp bytes: 0603539F E35DBF69
* [04] time_base: 
2400969845129752384725738662412037010364031309686872696685853017835577483033453697155629104443247189829603912142488904070729903714756009814926441089319983058422454699494905107871645497808138444180815872.00
 

The 'time_base' value is what I get when I printf the swapped-bytes value with 
a %f formatter.
Not sure why you're getting good results...
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binary floating point format

2017-03-30 Thread Carl Hoefs

> On Mar 30, 2017, at 7:04 PM, Greg Parker  wrote:
> 
> Simply shuffling VAX bytes and interpreting as an IEEE double would be 
> misleadingly close but still wrong.

You are right. Without anything to go on, it's a hopeless task. I really need 
to bump this back and try to get a hold of somebody that knows something about 
this (the only person who did has left, not on good terms). I was hoping that I 
could at least get 'reasonable' looking data to buy time so I could proceed 
with the rest of the processing. But not knowing what values the data will 
actually take is kind of a road block for now...
-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Binary floating point format

2017-03-30 Thread Carl Hoefs

> On Mar 30, 2017, at 6:40 PM, Steve Bird <sb...@culverson.com> wrote:
> 
> 
>> On Mar 30, 2017, at 8:25 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
>> wrote:
>> 
>> I have megabytes of raw legacy science datasets that I'm trying to read into 
>> my app and ingest into an array of doubles. The data is supposed to be 
>> organized as a stream of 8-byte doubles. I do not know how these datasets 
>> were generated, so I don't know what format (big/little endian, byte 
>> swapped, etc) they are in. 
>> Here is a hex dump of 4 binary doubles:
>> 
>> 49BF7DE372533C05 A8C02FE3135B4F09 86C22FE37E630B05 27C2C4E3E258BA08
> 
> A few minutes of LabVIEW work shows some semi-reasonable values if you swap 
> bytes:
> BF49E37D5372053C = -0.000790058
> C0A8E32F5B13094F = -3185.59
> 
> Do you know that those values are wrong?

Hmm, the -3185.59 doesn't look right. The data is _supposed_ to be:

1st double:  Time value, monotonically increasing, usually starting near 0.0
2nd double: Sensor value, oscillating waveform, centered about some arbitrary 
value

So I'm expecting data like:

0.011   0.57525634765625
0.012   0.45166015625000
0.013   0.29907226562500
0.014   0.13275146484375
0.015   -0.03173828125000
0.016   -0.18218994140625
0.017  -0.29602050781250
0.018   -0.38055419921875
...etc.

or even:

0.0182089.66467285156250
0.0202087.57525634765625
0.0222085.45166015625000
0.0242083.29907226562500
0.0262082.13275146484375
0.0282081.03173828125000
0.0302080.18218994140625
0.0322080.29602050781250
0.0342079.38055419921875
0.0362079.43060302734375
0.0382078.44738769531250
0.0402076.43640136718750
...etc

When I manually swap the bytes in my program, I still end up with invalid 
values.
-Carl

26 C3 E9 E2 6C 6A 38 0C 46 C3 E9 E2 6C 6A 40 0B 46 C3 E9 E2 83 6A DC 0A 66 C3 
E9 E2 83 6A 0E 0B
A5 C3 EF E2 AF 6A 40 0B A5 C3 EF E2 C6 6A 40 0B C5 C3 F5 E2 C6 6A 16 0A C5 C3 
F5 E2 DC 6A 0E 0B
26 C3 3C E3 9E 62 B2 09 26 C3 3C E3 9E 62 B2 09 26 C3 36 E3 B4 62 BA 08 06 C3 
36 E3 CB 62 C2 07
45 C4 76 E3 44 6C 38 0C 25 C4 76 E3 5A 6C 06 0C 25 C4 76 E3 5A 6C DC 0A 05 C4 
7D E3 70 6C DC 0A

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Binary floating point format

2017-03-30 Thread Carl Hoefs
I have megabytes of raw legacy science datasets that I'm trying to read into my 
app and ingest into an array of doubles. The data is supposed to be organized 
as a stream of 8-byte doubles. I do not know how these datasets were generated, 
so I don't know what format (big/little endian, byte swapped, etc) they are in. 

If I read the data directly into double variables, they evaluate as very small 
(E-92, etc).

I've tried all of these functions:

  NSSwapDouble()
  NSSwapBigDoubleToHost()
  NSSwapLittleDoubleToHost()
  NSConvertSwappedDoubleToHost()
  CFConvertDoubleSwappedToHost()

The above functions generally return invalidly large values (E+87, etc).

Here is a hex dump of 4 binary doubles:

49BF7DE372533C05 A8C02FE3135B4F09 86C22FE37E630B05 27C2C4E3E258BA08

It seems there's some structure to them, as the last byte is always in the 
range of 03 to A0, so maybe they somehow correspond to IEEE 754 
double-precision binary floating point format? 

Is there yet another function I could use to parse this binary data?
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-21 Thread Carl Hoefs
Thanks, that got it going.  It's a compromise. Maybe the options will be 
expanded in future iOS releases...
-Carl

> On Mar 21, 2017, at 12:39 PM, Saagar Jha <saa...@saagarjha.com> wrote:
> 
> That should be lot easier; just set yourself as the text field’s delegate and 
> override textFieldShouldBeginEditing.
> Saagar Jha
> 
>> On Mar 21, 2017, at 12:24, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> Alternately, is there a way to configure the alert to defer the launch of 
>> the keyboard until/unless the user wants to edit the textfield (by touching 
>> it)? Generally it won't need to be edited, maybe just the first time or so, 
>> thus having the keyboard always coming up would be distracting.
>> 
>> - Carl
>> 
>>> On Mar 21, 2017, at 12:12 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>> 
>>> Thanks for the hint. In the debugger I discovered that what looks to be a 
>>> UITextField displayed across the bottom of the alert is actually 
>>> implemented as a private object of class UIAlertControllerTextField.
>>> 
>>> So I can restrict the text to a portion of the textfield, but I can't find 
>>> a way to shorten the textfield's displayed width. Setting UIBorderStyleNone 
>>> also has no effect. I can change the font characteristics, but no 
>>> layout/display characteristics of the "textfield" itself appear to be 
>>> directly changeable. 
>>> 
>>> -Carl
>>> 
>>> 
>>>> On Mar 20, 2017, at 10:05 PM, Saagar Jha <saa...@saagarjha.com 
>>>> <mailto:saa...@saagarjha.com>> wrote:
>>>> 
>>>> I haven’t tested this, but have you tried calling [self layoutIfNeeded] in 
>>>> the completion block of [self presentViewController:animated:completion]?
>>>> 
>>>> Saagar Jha
>>>> 
>>>>> On Mar 20, 2017, at 16:09, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>>>> <mailto:newsli...@autonomy.caltech.edu> 
>>>>> <mailto:newsli...@autonomy.caltech.edu 
>>>>> <mailto:newsli...@autonomy.caltech.edu>>> wrote:
>>>>> 
>>>>> iOS 10.2.1
>>>>> 
>>>>> I'm using UIAlertController -addTextFieldWithConfigurationHandler: to 
>>>>> display an alert with a textfield. 
>>>>> 
>>>>> Is there any way to shorten the width of the displayed textfield? I've 
>>>>> tried setting its frame/bounds, but it has no effect.
>>>>> 
>>>>> -Carl
>>>>> 
>>>>> ___
>>>>> 
>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>>>>> <mailto:Cocoa-dev@lists.apple.com> <mailto:Cocoa-dev@lists.apple.com 
>>>>> <mailto: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 
>>>>> <http://lists.apple.com/> <http://lists.apple.com/ 
>>>>> <http://lists.apple.com/>>
>>>>> 
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
>>>>>  
>>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>>>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>>
>>>>> 
>>>>> This email sent to saa...@saagarjha.com <mailto:saa...@saagarjha.com>
>>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>>> <mailto: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 
>>> <http://lists.apple.com/>
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>>>  
>>> <https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu>
>>> 
>>> This email sent to newsli...@autonomy.caltech.edu 
>>> <mailto:newsli...@autonomy.caltech.edu>

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-21 Thread Carl Hoefs
Alternately, is there a way to configure the alert to defer the launch of the 
keyboard until/unless the user wants to edit the textfield (by touching it)? 
Generally it won't need to be edited, maybe just the first time or so, thus 
having the keyboard always coming up would be distracting.

- Carl

> On Mar 21, 2017, at 12:12 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
> wrote:
> 
> Thanks for the hint. In the debugger I discovered that what looks to be a 
> UITextField displayed across the bottom of the alert is actually implemented 
> as a private object of class UIAlertControllerTextField.
> 
> So I can restrict the text to a portion of the textfield, but I can't find a 
> way to shorten the textfield's displayed width. Setting UIBorderStyleNone 
> also has no effect. I can change the font characteristics, but no 
> layout/display characteristics of the "textfield" itself appear to be 
> directly changeable. 
> 
> -Carl
> 
> 
>> On Mar 20, 2017, at 10:05 PM, Saagar Jha <saa...@saagarjha.com> wrote:
>> 
>> I haven’t tested this, but have you tried calling [self layoutIfNeeded] in 
>> the completion block of [self presentViewController:animated:completion]?
>> 
>> Saagar Jha
>> 
>>> On Mar 20, 2017, at 16:09, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>> 
>>> iOS 10.2.1
>>> 
>>> I'm using UIAlertController -addTextFieldWithConfigurationHandler: to 
>>> display an alert with a textfield. 
>>> 
>>> Is there any way to shorten the width of the displayed textfield? I've 
>>> tried setting its frame/bounds, but it has no effect.
>>> 
>>> -Carl
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>>> <mailto: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 
>>> <http://lists.apple.com/>
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
>>> 
>>> This email sent to saa...@saagarjha.com
>> 
> 
> ___
> 
> 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.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-21 Thread Carl Hoefs
Thanks for the hint. In the debugger I discovered that what looks to be a 
UITextField displayed across the bottom of the alert is actually implemented as 
a private object of class UIAlertControllerTextField.

So I can restrict the text to a portion of the textfield, but I can't find a 
way to shorten the textfield's displayed width. Setting UIBorderStyleNone also 
has no effect. I can change the font characteristics, but no layout/display 
characteristics of the "textfield" itself appear to be directly changeable. 

-Carl


> On Mar 20, 2017, at 10:05 PM, Saagar Jha <saa...@saagarjha.com> wrote:
> 
> I haven’t tested this, but have you tried calling [self layoutIfNeeded] in 
> the completion block of [self presentViewController:animated:completion]?
> 
> Saagar Jha
> 
>> On Mar 20, 2017, at 16:09, Carl Hoefs <newsli...@autonomy.caltech.edu 
>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> iOS 10.2.1
>> 
>> I'm using UIAlertController -addTextFieldWithConfigurationHandler: to 
>> display an alert with a textfield. 
>> 
>> Is there any way to shorten the width of the displayed textfield? I've tried 
>> setting its frame/bounds, but it has no effect.
>> 
>> -Carl
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
>> <mailto: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 
>> <http://lists.apple.com/>
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com 
>> <https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com>
>> 
>> This email sent to saa...@saagarjha.com
> 

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

UITextField width of UIAlertController -addTextFieldWithConfigurationHandler:

2017-03-20 Thread Carl Hoefs
iOS 10.2.1

I'm using UIAlertController -addTextFieldWithConfigurationHandler: to display 
an alert with a textfield. 

Is there any way to shorten the width of the displayed textfield? I've tried 
setting its frame/bounds, but it has no effect.

-Carl

___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMutableData +dataWithLength: sets errno?

2017-03-14 Thread Carl Hoefs

> On Mar 14, 2017, at 4:27 PM, Greg Parker <gpar...@apple.com> wrote:
> 
>> 
>> On Mar 14, 2017, at 4:08 PM, John McCall <rjmcc...@apple.com 
>> <mailto:rjmcc...@apple.com>> wrote:
>> 
>>> On Mar 14, 2017, at 7:00 PM, Carl Hoefs <newsli...@autonomy.caltech.edu 
>>> <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>> macOS 10.12.3, Xcode 8.2.1, ObjC
>>> 
>>> I'm finding the following line to be problematic:
>>> 
>>>   NSMutableData *myData = [NSMutableData dataWithLength:80];
>>> 
>>> I assume this ends up calling calloc(3) to allocate and zero out the data. 
>>> But for some reason, it's always setting errno to a seemingly random 
>>> nonzero value, generally either errno=2 (ENOENT) or errno=22 (EINVAL). 
>>> 
>>> Now that I know it does this, I can make accommodations for it, but is this 
>>> expected behavior? 
>> 
>> I don't know why it's happening here, but unless you're calling a function 
>> that specifically documents its errno behavior, you should assume that every 
>> call you make might randomly overwrite errno with gibberish.
> 
> The POSIX standard specifically states that errno's value is undefined almost 
> everywhere and can be arbitrarily changed by almost anything.
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html 
> <http://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html>
> 

Thanks, John & Greg.  I simply wasn't aware of this!
-Carl


___

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.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


  1   2   3   >