Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
tmesis
Jan 18, 2007

sup holmes
Megamarm
We create a hidden user using dscl for our application's server to operate as. For years we've been plagued by macOS updates deleting this user for some (but not all) of our user base. Our application installer creates the user like below. Is there a better way to create a hidden user to avoid it getting randomly deleted?

code:
    dscl . -create /Users/$user_name
    dscl . -append /Users/$user_name UserShell /usr/bin/false
    dscl . -append /Users/$user_name UniqueID $new_uid
    dscl . -append /Users/$user_name PrimaryGroupID 80
    dscl . -append /Users/$user_name Password \*
    dscl . -append /Users/$user_name NFSHomeDirectory /var/empty

Adbot
ADBOT LOVES YOU

Escape Goat
Jan 30, 2009

Good Sphere posted:

Just as a side note, I’m taking a risk by storing whether or not someone purchased it in a plist, because that isn’t very secure. The user could trick the app into thinking it was purchased if they know what to put in that plist file by opening the application’s contents. I think it’s unlikely many people would make that sort of effort, especially for an app that’s probably going to end up being 1-2 dollars.

I came to the same conclusion in terms of risk/reward for a few dollars' purchase. I felt like any efforts I made to obfuscate the content would just as likely cause unforeseen bugs for paying customers.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

tmesis posted:

We create a hidden user using dscl for our application's server to operate as. For years we've been plagued by macOS updates deleting this user for some (but not all) of our user base. Our application installer creates the user like below. Is there a better way to create a hidden user to avoid it getting randomly deleted?

code:
    dscl . -create /Users/$user_name
    dscl . -append /Users/$user_name UserShell /usr/bin/false
    dscl . -append /Users/$user_name UniqueID $new_uid
    dscl . -append /Users/$user_name PrimaryGroupID 80
    dscl . -append /Users/$user_name Password \*
    dscl . -append /Users/$user_name NFSHomeDirectory /var/empty

What is $new_uid? It is illegal to create users <500 on macOS. Those are all reserved for the system. You might get away with it until an OS update includes a user with that ID. The installer will unceremoniously destroy your user to make way for the system user.

You should query for the next-available uid >500:

code:
MAXUID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1)
NEXTUID=$((MAXUID+1))

Simulated fucked around with this message at 05:50 on Oct 3, 2018

tmesis
Jan 18, 2007

sup holmes
Megamarm

Simulated posted:

What is $new_uid? It is illegal to create users <500 on macOS. Those are all reserved for the system. You might get away with it until an OS update includes a user with that ID. The installer will unceremoniously destroy your user to make way for the system user.

You should query for the next-available uid >500:

code:
MAXUID=$(dscl . -list /Users UniqueID | awk '{print $2}' | sort -ug | tail -1)
NEXTUID=$((MAXUID+1))

Yeah we basically do that exact thing earlier in the function after we got bit in the rear end by that exact thing back in Mountain Lion(?) days. We also tried setting it > 1000 just for kicks and that did not work either.

Good Sphere
Jun 16, 2018

I have a Metal question that's been baffling to me. I create a CIImage by grabbing either half the height or width and flipping it using CGAffineTransforms to make a "mirrored" effect. When I go to render it on a MTKView and scale up the CIImage using CGAffineTransforms, I can see the seams between the mirrored images. I somewhat understand how this could happen since CIImages are just image data that can be represented as an image, but I don't understand how not make it happen when scaling it up in the MTKView's CIContext render. That same CIImage is fine when it is taken by the camera and saved because at that point it has nothing to do with Metal scaling it up.

The draw function I'm using is here, with "image" being the CIImage being set:

code:
	override func draw(_ rect: CGRect)
	{
		guard let
			image = image,
			let targetTexture = currentDrawable?.texture else
		{
			return
		}
		
		let commandBuffer = commandQueue.makeCommandBuffer()
		
		let bounds = CGRect(origin: CGPoint.zero, size: drawableSize)
		
		let originX = image.extent.origin.x
		let originY = image.extent.origin.y
		
		let scaleX = drawableSize.width / image.extent.width
		let scaleY = drawableSize.height / image.extent.height
		let scale = min(scaleX, scaleY)
		let scaledImage = image
			.transformed(by: CGAffineTransform(translationX: -originX, y: -originY))
			.transformed(by: CGAffineTransform(scaleX: scale, y: scale))
				
		ciContext.render(scaledImage,
						 to: targetTexture,
						 commandBuffer: commandBuffer,
						 bounds: bounds,
						 colorSpace: colorSpace)
		
		commandBuffer?.present(currentDrawable!)
		
		commandBuffer?.commit()
	}

Doctor w-rw-rw-
Jun 24, 2008
I want a 4x4 matrix type in Swift. Is _FixedArrayN the right way to make one?

EDIT: Nope. I’ll just write my own with a struct.

Doctor w-rw-rw- fucked around with this message at 00:41 on Oct 18, 2018

lord funk
Feb 16, 2004

Doctor w-rw-rw- posted:

I want a 4x4 matrix type in Swift. Is _FixedArrayN the right way to make one?

EDIT: Nope. I’ll just write my own with a struct.

Yep that's what I did.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
Isn’t Accelerate.framework bridges to Swift? I’d use whatever it or Metal provide.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
In general “don’t write your own matrix math” should be right up with “don’t write your own sort.”

Doctor w-rw-rw-
Jun 24, 2008
Neither of those are open-source nor run on Linux. No real choice.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
Why do you care about running on Linux?

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
It’s OK to have separate code paths for different platforms, you know. Good even, if it means the experience is better for users.

Doctor w-rw-rw-
Jun 24, 2008

eschaton posted:

It’s OK to have separate code paths for different platforms, you know. Good even, if it means the experience is better for users.
I'm messing with Swift on Linux, not really macOS or iOS. "The only good way to do X is currently Darwin-only" shouldn't be the only answer to "I need to do X" IMO.

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?
I wouldn’t expect Apple to just make every possible library and framework Open Source and bring it to Linux.

Swift on Linux is very much about servers. That’s not to say things like matrix math are useless to servers, but they’re much more niche there than on end user systems.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I think we’re literally at this moment discussing a SIMD library on Swift Evolution that includes a 4x4 matrix type.

Doctor w-rw-rw-
Jun 24, 2008

eschaton posted:

I wouldn’t expect Apple to just make every possible library and framework Open Source and bring it to Linux.
Note that I did some research about what I could use that was already there, asked about approach, clarified that I couldn't choose Apple-only frameworks, and ultimately decided to write my own. Pooh-poohing me writing my own matrix math because my own choices limited me, then turning around and creating an entitled strawman asking for a port is a little antagonistic.

rjmccall posted:

I think we’re literally at this moment discussing a SIMD library on Swift Evolution that includes a 4x4 matrix type.
Very cool!

eschaton posted:

Swift on Linux is very much about servers. That’s not to say things like matrix math are useless to servers, but they’re much more niche there than on end user systems.
Despite my criticisms of it, Swift is one of a very small pool of good/safe/fast OOP languages, and pretty much the only modern one (Rust, for example, though it's modern/safe/fast, isn't OOP). It would be a loving tragedy for Swift to never be anything but an iOS language and a server language for Linux.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
On a previous project, we created our own custom Matrix type for matrices that were 100x100 doubles or bigger. We started by manually writing out the matrix math, and it was ridiculously slow.

We moved to the Accelerate framework (inside of the Matrix type itself) and sped up the math something like 1000%. It was pretty awesome.

So yeah. Don’t write your own matrix math if you can at all avoid it.

Doctor w-rw-rw-
Jun 24, 2008
I get that, but between abandoning the thing (because the functionality I want doesn't exist), waiting a couple of months (because the functionality I want will exist), and writing some lovely thing that runs for now, I'm going to pick the last one.

lord funk
Feb 16, 2004

Anyone have a USB-C --> Headphone + USB-C adapter they use, and does the extra USB port allow it to connect to a computer normally, or is it only for power?

Small White Dragon
Nov 23, 2007

No relation.
Can I have my account be part of two developer teams, or do I have to create a second Apple ID?

Doctor w-rw-rw-
Jun 24, 2008

Small White Dragon posted:

Can I have my account be part of two developer teams, or do I have to create a second Apple ID?

I believe it can be a part of two developer teams.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
One account can be part of many development teams.

You used to sometimes need multiple Apple IDs for App Store Connect, but they’ve fixed that recently.

lord funk
Feb 16, 2004

Could use some help figuring out how non-escaping v. escaping works.

Opened a project in Xcode 10 and I'm getting this error:



Timing is defined as:

code:
public typealias Timing = (Float) -> Float
I kind of get what's going on here, but my attempts to fix it haven't gone anywhere.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Try this:

code:
timing: @escaping Timing

dizzywhip
Dec 23, 2005

Here's an attempted explanation: the timing closure that's being passed into the function is expected to be non-escaping because it's not explicitly marked as escaping. When you put the closure into an array, you're storing it there for the lifetime of that array. Even though the array doesn't stick around past the end of that function (assuming that the call to Ramper.rampValues doesn't store it anywhere), the compiler doesn't know that, so it won't let you store it there and potentially let it escape.

lord funk
Feb 16, 2004

@rjmccall yep, that did it.

dizzywhip posted:

Here's an attempted explanation: the timing closure that's being passed into the function is expected to be non-escaping because it's not explicitly marked as escaping. When you put the closure into an array, you're storing it there for the lifetime of that array. Even though the array doesn't stick around past the end of that function (assuming that the call to Ramper.rampValues doesn't store it anywhere), the compiler doesn't know that, so it won't let you store it there and potentially let it escape.

Yeah that totally clarifies. Thanks!

Doctor w-rw-rw-
Jun 24, 2008
What's the current thinking on custom attributes in Swift (or clang for that matter)? Using sourcekitten and picking up on custom attributes which don't otherwise affect compilation would be useful when building some tooling that benefits from static analysis.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
It's a big design space if you want any sort of validation / semantic effect at all, and in the short term it's pretty easy to get the same tooling impact by parsing comments.

Doctor w-rw-rw-
Jun 24, 2008
That makes a lot of sense. Dang.

Doh004
Apr 22, 2007

Mmmmm Donuts...
I'm looking to upgrade my own personal Mac laptop for home development as I'm still rocking my mid-2012 Macbook Air. I do more than just iOS development now want it to be capable of doing so.

I'm thinking the refreshed Macbook Airs would be more than fine for this, right? I feel like XCode has only gotten better (Swift compilation definitely has), so the air should be more than capable. I'm much more willing to pay ~$1700 instead of a $2500 MBP, especially given my needs now.

I have a 2017 MBP that's very beefy here at work and is very able to build our somewhat large iOS app in XCode just fine.

(I know this is the iOS development thread and not the hardware thread)

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Either should be a reasonable development machine so it depends on whether you value weight/portability or performance. It really depends on what is right for you.

Doh004
Apr 22, 2007

Mmmmm Donuts...

Simulated posted:

Either should be a reasonable development machine so it depends on whether you value weight/portability or performance. It really depends on what is right for you.

I'd say for a personal machine (potentially do some freelance/contract work on the side), I'd value weight and portability. I'm not doing any game development or anything super heavy on the graphics.

lord funk
Feb 16, 2004

My thought is absolutely yes, especially if it's your only machine and you value portability. You'll be fine.

Escape Goat
Jan 30, 2009

I've had my app up for pre-order, version 1.0, for about a month. I created a version 1.01 in app store connect to capture all of the changes I've made since it went up for pre-order, but I want to make sure I don't accidentally do something stupid like nuke all of the pre-orders because they're tied to 1.0.

Do I need to do anything to account for the fact that 1.0 is in pre-order, or can I just submit 1.01 for review and users that pre-ordered will get that on launch day?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What are the requirements for being able to view the JavaScript console on a connected iDevice?

I tried an iPhone 6S and 8+ (Both lates iOS), two cables, everything works on my Mojave 15” but neither work on my 2009 Mini running El Cap. The device shows in the safari develop menu but goes away befor you can use it.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I’ve never seen any kind of official or even unofficial documentation of what works with what. I have seen that feature act incredibly strangely and suddenly start/stop working. For example, sometimes Safari stops working but Purple Safari works, or vice versa. Quitting or restarting various things sometimes changes what works. I’m guessing you’ve tried all that already, so basically all I’m saying is you’re not alone.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
I'm currently using the IFTTT app on my iPhone with a webhook to trigger a rich notification to be sent to my phone (via the IFTTT app). It works but I'd like to be be able to add rich actions(?) to the notification, such as "remind me later" or "remind me tomorrow." For various reasons Reminders doesn't work for me/fit into my workflow here. So I had an idea to create a single purpose iOS app that will let me push notifications to it (also via a rest webhook set up on my own server) with those rich notification actions.

Can I do this with a free developer account and side loading the app? Or do I need a $99 developer account? Can I even send non-local push notifications to my iPhone without the app being on the App Store?

e: Looks like I'd need a $99 developer account to get access to remote push notifications.

Boris Galerkin fucked around with this message at 09:28 on Nov 13, 2018

GameCube
Nov 21, 2006

Trying to create some subscriptions for an iOS app. Where the fr*ck is the "+" to add localizations???



e: after changing from "developer" to "admin," the problem is resolved, because now i just get an error page any time i go to the "my apps" section :newlol:

GameCube fucked around with this message at 20:15 on Nov 15, 2018

lord funk
Feb 16, 2004

Anyone know why I'm seeing two repositories now in my source control navigator? They both point to the same remote. I don't know if this is a Git issue or an Xcode one.

Only registered members can see post attachments!

Adbot
ADBOT LOVES YOU

Good Sphere
Jun 16, 2018

Anyone know anything special I need to change when developing for devices that have a native color space of Display P3 instead of sRGB? It has nothing to do with my assets, but images I'm pulling through the camera rendered onto a MTKView and applying CIFilters to. It seems like devices with Display P3 a very unsaturated compared to ones using sRGB, and I need to figure out whatever needs to be changed to make them look more similar. I've only tested the iPhone XS that has Display P3 personally, and it may have to do with something else other than the color space, but have no clue if this is true and where to start off to understand why the camera's image is so much less saturated.

Good Sphere fucked around with this message at 19:38 on Nov 28, 2018

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply