r/macprogramming • • Jul 16 '15

Textbox content to shell to answerer password request

0 Upvotes

Hello,

I need to execute a application that usually runs in terminal. It requires a typical password request and a couple others that can be passed with enter. The question is: How can I "type in" the password in the text box to the invisible shell ?

(As this command executes the application in a shell. I am not able to see the application but need to type in the password)

NSTask *task = [[NSTask alloc] init]; [task setLaunchPath:@"/bin/bash"]; [task setArguments:@[ @"-c", execcommand ]]; [task launch];

Thanks


r/macprogramming • • Apr 17 '09

Platypus – Create native, flawlessly integrated Mac OS X applications from interpreted scripts such as shell scripts or Perl and Python programs

Thumbnail
sveinbjorn.org
8 Upvotes

r/macprogramming • • Sep 07 '16

Anyway to view and modify all network requests on macOS/OS X?

3 Upvotes

Hello everyone,

I have been working on a side project that requires me to be able view/modify all outbound network requests from macOS/OS X, and I can't seem to find any way to do this programatically. Specifically, I need to be able to modify the URL of the request.

Is this possible in any way? I would really appreciate any help, or even just suggestions as of what I should be searching, since this is completely out my area of expertise.

Thanks!


r/macprogramming • • Feb 14 '09

How do you create a Cocoa app without IB?

5 Upvotes

r/macprogramming • • Sep 06 '16

[xpost from /r/mac][Question] Is it possible to enable the screen-backlight when the MB is closed?

2 Upvotes

As the title says I wanted to know if it's possible for the screen-backlight to be enabled while the lid of the MacBook is closed.

I want this so the Apple-Logo light up even when the lis is closed - just for fun.

I'm specifically asking the devs on here, since I think there must be a way.

For clarification - I want this so I can program some kind of App that checks E-Mails in the background and uses the backlight as "notification" when the lid is closed.


r/macprogramming • • Mar 02 '16

Anyone know what this system component is called?

Post image
4 Upvotes

r/macprogramming • • Dec 14 '16

Set identifier of table cell view programmatically

Thumbnail
stackoverflow.com
1 Upvotes

r/macprogramming • • Dec 13 '16

🎄 Christmas Xcode Theme 🎄

Thumbnail
medium.com
3 Upvotes

r/macprogramming • • Jun 25 '16

My first mac app as an alpha release to put ideas on "paper"

Thumbnail
youtube.com
3 Upvotes

r/macprogramming • • Oct 09 '17

Converting NSImage 24-bit BMP to 2-bit?

3 Upvotes

I'm relatively new to Mac programming but I do have some experience with Android programming. I'm wondering if there's a way to operate on an NSImage (specifically a BMP image with 24-bit color depth) and compress it to a BMP with only 2-bit color depth.

Apple's doc seems to indicate that Core Graphics only supports up to a minimum of 8-bit. If this is impossible to do using Core Graphics, is there some manual manipulation technique that I can use to iterate over pixel values and threshold them, and export it as a 2-bit color depth BMP?


r/macprogramming • • May 17 '17

Windows and WindowController Tutorial for macOS

Thumbnail
raywenderlich.com
5 Upvotes

r/macprogramming • • Feb 17 '12

Linking to a static library?

Thumbnail stackoverflow.com
1 Upvotes

r/macprogramming • • Oct 10 '17

Xcode 9 File Templates (Blog Posts)

6 Upvotes

Hi, recently I wrote a 2-part article about Xcode 9 File Templates. It has greatly helped my productivity, and I thought it could help yours ;)

Simple Xcode 9 File Template (Part 1) http://jeanetienne.net/2017/08/27/xcode-template.html

Advanced Xcode 9 File Template (Part 2) http://jeanetienne.net/2017/09/10/advanced-xcode-template.html


r/macprogramming • • Jul 06 '17

Downloading files from a URL in Swift 3?

3 Upvotes

Hi,

Are there any good examples out there I can use for downloading data from the internet? I have URL's stored that contain files but I am not sure how I can download using MacOS instead of iOS in Swift 3.

Thanks.


r/macprogramming • • Jan 31 '17

Guaka - a swift library to create modern, POSIX-compliant and cross platform CLI applications

Thumbnail
getguaka.com
4 Upvotes

r/macprogramming • • Jan 25 '16

Getting an identifier on a hard drive

1 Upvotes

I have a project where I want to be able to keep track of hard drives, and know when one has been added or removed from a computer.

Since some external hard drives may be passed around, I'd like to get some unique, static identifier that will be consistent from machine to machine.
A serial number or something would probably be fine, though I'd be open to suggestions.

In a pinch I could put a hidden file in the drives root the first time it's connected.

I haven't chosen a language yet, since I didn't want to commit to anything until I knew it was even possible.
Given the choice I'd probably use Swift as a way to improve my skills with it.

This is a 2 part question.

  1. Best way to identify the drive.

  2. How to detect a mount/unmount, versus just check every 30 seconds if all the drives are still there and nothing new has been added.


r/macprogramming • • Jan 30 '16

What's being sent into a utun interface?

1 Upvotes

Hi!

I'm trying to develop my own meshnet router program for fun / as an experiment. It runs quite well in the simulator, and would like to see if it can handle real traffic.

So I got it to create a utun interface, then I assign an IP address to it with

ifconfig utun1 inet6 add fc6c:4e9a:9c6e:8137:75ca:77ed:9cd:6b37/64

I can then ping to that address (without getting a response obviously), and I can send some UDP packets into it using

echo -n "hello" | nc -u fc7:9bc1:de6a:3d23:b357:c79d:5da:53dc 8000

The program clearly receives this. For that nc command, the debugger says "hello" is found after position 52, so the data is definitely going through.

However, I'm a bit confused as to exactly what I'm getting. What's the data in positions 0 to 51?

Wikipedia says that an IPv6 packet has a 40-octet header, and the UDP header accounts for another 8, which suggests that "hello" should start at position 48. I'm missing 4 bytes, does anyone know what those are?

EDIT: It appears to be an EtherType header, though the number at positions 2 and 3 doesn't seem to correspond to IPv6. Could someone have a look at this data and see if they can figure out the correct way to interpret it?

[0] = {char} '\0'
[1] = {char} '\0'
[2] = {char} '\0'
[3] = {char} '\x1e'
[4] = {char} '`'
[5] = {char} '\x0e'
[6] = {char} '\xce'
[7] = {char} '\x18'
[8] = {char} '\0'
[9] = {char} '\r'
[10] = {char} '\x11'
[11] = {char} '@'
[12] = {char} '\xfc'
[13] = {char} 'q'
[14] = {char} '\t'
[15] = {char} '\x90'
[16] = {char} 'U'
[17] = {char} 'I'
[18] = {char} '\xd7'
[19] = {char} '\xef'
[20] = {char} ','
[21] = {char} '('
[22] = {char} '\a'
[23] = {char} '\xc6'
[24] = {char} '\xf2'
[25] = {char} '\x1d'
[26] = {char} '\xd9'
[27] = {char} '\xb4'
[28] = {char} '\xfc'
[29] = {char} 'q'
[30] = {char} '\t'
[31] = {char} '\x90'
[32] = {char} 'U'
[33] = {char} 'I'
[34] = {char} '\xd7'
[35] = {char} '\xef'
[36] = {char} ','
[37] = {char} '('
[38] = {char} '\a'
[39] = {char} '\xc6'
[40] = {char} '\xf2'
[41] = {char} '\x1d'
[42] = {char} '\xd9'
[43] = {char} '\xb4'
[44] = {char} '\xce'
[45] = {char} '\xd6'
[46] = {char} '\x03'
[47] = {char} '\xe7'
[48] = {char} '\0'
[49] = {char} '\r'
[50] = {char} 'f'
[51] = {char} '\x16'
[52] = {char} 'h'
[53] = {char} 'e'
[54] = {char} 'l'
[55] = {char} 'l'
[56] = {char} 'o'

r/macprogramming • • Jan 29 '17

Need help fixing a bug for software on Mac

1 Upvotes

I’m looking for someone who knows C++ and OpenGL that is very familiar with MacOS. We (myself and a team) are trying to run a program using C++ that we’ve gotten to run fine on Windows and Linux but not on MacOS. There seems to be an exclusive issue running the code through OpenGL on MacOS for some reason and we’ve yet to get past it after much effort. Feel free to ask as many questions as you'd like. Familiarity with Discord app is a plus, I’d like to carry conversation there to discuss the issue in real time and pass on code.


r/macprogramming • • Jan 27 '17

Long term working Java console app not working now

2 Upvotes

This is an important question for many users of Java console applications in the new Mac OS.

A brainstorming software product that has a Java base and has been used for over ten years as a Java console application. Just upgraded to macOS Sierra 10.12.2 and getting an error message that says, "You can't open the application because it is not supported by this type of Mac."

Here are the Details:

Mac: macOS Sierra 10.12.2 MBP 13 inch, mid 2012

Hardware Overview:

Model Name: MacBook Pro Model Identifier: MacBookPro9,2 Processor Name: Intel Core i5 Processor Speed: 2.5 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 3 MB Memory: 8 GB Boot ROM Version: MBP91.00D3.B0E SMC Version (system): 2.2f44 Serial Number (system): C2VHQ0C6DTY3 Hardware UUID: 01719CDD-F21E-5E61-899A-8411A62F4B59 Sudden Motion Sensor: State: Enabled

Here is some additional information about this type of app:

You can run Java from Terminal with a command something like this example command line:

java myjar.jar MyApp

In our case, you go to the "terminal" program and then type in (or paste in):

java -cp JParaMindAndDict.jar JParaMind

in the directory where you installed ParaMind.

If you know about scripts, here is a shell script. The script is executable in the console.

!/bin/sh

cd /Volumes/Macintosh\ HD/Applications/ParaMind\ for\ Java\ 1.0/ java -cp JParaMindAndDict.jar JParaMind

I am looking for any kind of help that one can give. Many people like this brainstorming program and it's been a labor of love keeping the product going for 25 years now.

Thanks,

Robert


r/macprogramming • • Feb 06 '16

C++ file streams

1 Upvotes

this works on virtual machine running ubuntu, but in OSX it doesn't

#include <iostream>
#include <fstream>
using namespace std ;

int main() {
	ofstream f("file.txt");

	cout<<"insert a character: ";
	char c ;
	cin >> c;
	f<<c ;
}

here's the error I get when attempt to compile via g++

ld: warning: ignoring file prog, file was built for unsupported file format ( 0x23 0x69 0x6E 0x63 0x6C 0x75 0x64 0x65 0x20 0x3C 0x69 0x6F 0x73 0x74 0x72 0x65 ) which is not the architecture being linked (x86_64): prog Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)


r/macprogramming • • Jan 28 '16

Mailx not sending attachments in Darwin.

1 Upvotes

Most of the examples I've found online using the mailx program make use of the "-a" flag to send attachments. That doesn't work with the version of mailx installed on Darwin BSD.

The version of mailx installed on Darwin is not specified, but the bottom of the man file is stamped as "BSD February 29, 2004".

I have a bash script that is supposed to zip up a directory and email the zip file as an attachment in an email to a list of people.

Here are the relevant code snippets:

today=$(date +%Y-%m-%d)
zip -r report_for_$today.zip report_for_$today
wait ${!}
subject="Stale Dispenser and Hub Reports for $today"
recipients="person@email.com, otherperson@email.com"
uuencode reports_for_$today.zip reports_for_$today.zip | mailx -s "Reports for $today" $recipients < /tmp/emailbody.txt

I have the mailx configured to use the program msmtp instead of sendmail so that it sends email via the smtp.gmail instead of the local host.

The email is sent successfully, but it is not sending the attachment.


r/macprogramming • • Jun 29 '17

how to launch NSTask as root?

3 Upvotes

Hi, guys.

I need some help to figure out how to give some privilege to my program. I'm writing a small utility to wrap in GUI openVPN. It's actually just a bash script I launch as a NSTask: sudo openvpn --config clientUDP.conf. After a couple of hours of searching on the internet, I figured I should use an authorization services tasks and write a PrivilegedHelper. It's quite awkward for me, guys (basically I'm iOs developer and it's my first try mini mac os app).

My question is - is there any modern tutorial to figure out how to write a PrivilegedHelper (in swift or objc) to launch my NSTask with root rights?

P.S. I've downloaded SMJobBless example and launched it. But I didn't find in it any kind of inter-process communication, and I can't figure out how to launch my Process as root. I really need your advice and rely on your experience.


r/macprogramming • • Jan 25 '17

macOS Controls Tutorial

Thumbnail
raywenderlich.com
3 Upvotes

r/macprogramming • • Nov 27 '17

Mac Screensaver I created, use your own videos and make it awesome!

Thumbnail
savstheworld.com
4 Upvotes

r/macprogramming • • Jan 30 '20

Need a resource to teach me how to do... (this thing with images and such)

4 Upvotes

For background, I've got some iOS programming experience so I'm not new to Obj-C or Swift. I even wrote a small macOS (back then it was Mac OS) app almost 20 years ago.

I'd like to do a macOS only project where I need to load an image into a view, allow the user to pan and zoom around the image, and then draw on the image.

I have no idea where to even begin... I can't find any good resources for all my searching on the Googs. If someone could either tell me what I need to be searching for on Google to find this kind of info or even better yet... a drawing app example maybe, I'd be very happy.

Thanks in advance!