macos

Writing files to an iOS device from a MacOS app

情到浓时终转凉″ 提交于 2021-02-08 05:49:35
问题 I'd like to be able to transfer files from a MacOS app to a connected iOS devices, so a related iOS app can open them - effectively replicating iTunes music functionality, but not for musc. Is this possible? I know you can set an iOS app to have file sharing enables so you can drop files into it with iTunes, but I'd prefer to do it in my own app. 回答1: This library came up in another question on SO recently: https://bitbucket.org/tristero/mobiledeviceaccess/ - I don't know anything about it

Running crontab in mac

自闭症网瘾萝莉.ら 提交于 2021-02-08 05:42:21
问题 I'm trying to test a python script that has to be run by a cron job. I'm trying to config the cron job in my mac but doesn't run. Here is my cron job... * * * * * user /usr/local/bin/python3 ~/Documents/wpc/stocks/daily_stock.py If I crontab -l the job is there. I ran the script manually and works but is not running by the cron job. How can I fix this? 回答1: I used the following method to solve this issue on Mac OS. You can add a shebang to the top of your python script to specify the Python

Running crontab in mac

时间秒杀一切 提交于 2021-02-08 05:41:40
问题 I'm trying to test a python script that has to be run by a cron job. I'm trying to config the cron job in my mac but doesn't run. Here is my cron job... * * * * * user /usr/local/bin/python3 ~/Documents/wpc/stocks/daily_stock.py If I crontab -l the job is there. I ran the script manually and works but is not running by the cron job. How can I fix this? 回答1: I used the following method to solve this issue on Mac OS. You can add a shebang to the top of your python script to specify the Python

NSTokenField: different colors for tokens

被刻印的时光 ゝ 提交于 2021-02-08 05:19:13
问题 I have created an NSTokenField in my xib. I'd like to display tokens with different colors inside that tokenField. Meaning: some tokens will be blue, the rest will be red (according to their content). Is that possible? The following code doesn't work for me. I hope someone can help me out: - (id)tokenField:(NSTokenField *)tokenField representedObjectForEditingString:(NSString *)editingString { id returnRepresentedObject = nil; NSTokenFieldCell *tf = [[NSTokenFieldCell alloc] init]; tf

Swift NSWindow shows up and disappears immediately

家住魔仙堡 提交于 2021-02-08 04:57:17
问题 I'm a complete beginner to Swift, so this may be a silly question, but I can't figure out how this works... I have a view with a button inside which calls the following code: let window = NSWindow() window.center() window.title = "test" window.makeKeyAndOrderFront(self) When I click the button the window opens just for a moment and disappears a few milliseconds later. Can anyone help me with that? It seems I have a quite serious misunderstanding about views in Cocoa ;-) Thanks Tom 回答1: The

Meaning of “index” parameter in glEnableVertexAttribArray and (possibly) a bug in the OS X OpenGL implementation

依然范特西╮ 提交于 2021-02-08 04:48:47
问题 1) Do I understand correctly that to draw using vertex arrays or VBOs I need for all my attributes to either call glBindAttribLocation before the shader program linkage or call glGetAttribLocation after the shader program was successfully linked and then use the bound/obtained index in the glVertexAttribPointer and glEnableVertexAttribArray calls? To be more specific: these three functions - glGetAttribLocation, glVertexAttribPointer and glEnableVertexAttribArray - they all have an input

Determine which application is using audio device

一个人想着一个人 提交于 2021-02-08 04:01:21
问题 I'm currently using CoreAudio in macOS to determine if a specific audio input device is in use. I'm trying to find a little more information about what's going on with that device if it is in use, but struggling to find any information on how to do this. 1) Is it possible to find the application that is currently using a specific audio input device? 2) Is it possible to determine if an application is using an audio device (input or output) and has the device currently muted in that specific

Determine which application is using audio device

廉价感情. 提交于 2021-02-08 04:01:19
问题 I'm currently using CoreAudio in macOS to determine if a specific audio input device is in use. I'm trying to find a little more information about what's going on with that device if it is in use, but struggling to find any information on how to do this. 1) Is it possible to find the application that is currently using a specific audio input device? 2) Is it possible to determine if an application is using an audio device (input or output) and has the device currently muted in that specific

How to run a Windows.Forms C# program from Terminal in OSX?

与世无争的帅哥 提交于 2021-02-08 04:00:43
问题 I have to use System.Windows.Forms for my C# course in school but I own a Macbook and Visual Studio says that it doesn't exist. I read that I could use WinForms if I installed Mono and then compile and run it from terminal using mcs hello.cs -pkg:dotnet . "hello.cs" is just a Hello World program using System.Windows.Forms... it compiles but when I do mono hello.exe it says: WARNING: The Carbon driver has not been ported to 64bits, and very few parts of Windows.Forms will work properly, or at

How to change NSToolBar background color?

我们两清 提交于 2021-02-08 03:56:12
问题 I'm using a NSToolbar and I'm trying to change the color to a white instead of the default gray. How can I accomplish that? 回答1: Since the toolbar integrates into the window title bar, you need to draw both the title bar and the toolbar. Which basically means you need to take over drawing for the entire window. This requires "swizzling" which, while it works well, is not supported by Apple and therefore may get your app rejected from the app store. Basically you need to inject your own code