HNHacker News
TopNewBestAskShowJobs

mayoff

2,016 karma · joined June 2, 2010

Random bits of iOS programming
submissionscomments
mayoff··on Refurb Weekend: Canon Cat
I bought one on eBay in 2000 for $610 (eBay item number 418348564).
mayoff··on AI-generated sad girl with piano performs the text of the MIT License
Is this sound file itself under the MIT license?
mayoff··on Ask HN: Mnemonic for shift() and unshift()?
Unshift, like push, adds an element to the array.

“Unshift”, like “push”, contains the letter “u”.

mayoff··on macOS 14.4 causes JVM crashes
I don’t think the article claims that a Java process tries to access some other process’s memory.

In a typical modern operating system, a memory page can be non-writable and non-executable, writable and non-executable, or non-writable and executable, but not simultaneously writable AND executable.

If you generate executable code at runtime, then you need write access to a page to write the executable code into that page. Then you need to tell the operating system to change the page from writable to executable.

If you then try to write to the page, you’ll get a signal (SIGSEGV or SIGBUS, according to the article).

Oracle’s JVM apparently relies on this behavior: a Java process sometimes tries to write to a page (in its own memory space) that is not marked writable. The JVM then catches the SIGSEGV and recovers (perhaps by asking the operating system to change the page back from executable to writable, or by arranging to write to a different page, or to abort the write operation altogether).

mayoff··on SQLite on macOS: Not ACID compliant with the bundled version (2022)
You issue `pragma journal_mode=wal` once after creating the database. The change is persistent.

https://www.sqlite.org/wal.html#persistence_of_wal_mode

mayoff··on Total Functional Programming (2004) [pdf]
The fib' function (the more efficient version of fib) is defined using f. So the goal is to prove that f computes the same thing as fib (given the appropriate arguments to f and fib). Hence the theorem needs to use f on at least one side of the equation.
mayoff··on 'We had to educate Oracle about our contract,' CIO says after Big Red audit
A few years ago, my then-employer (a smallish company, < 150 employees) had to deal with an Oracle compliance audit. I was shocked at the time to learn that there are companies (like Palisade Compliance mentioned in this article) that specialize in Oracle license compliance. We made it through just fine (in fact I believe we managed to get a small refund!), but having been through that (though not in any way directly involved), my take is that no one should ever do business with Oracle if they can possibly avoid it.
mayoff··on Prompt 3
I used Prompt 2 for a while, but switched to Secure Shellfish because

- Shellfish can act as a file provider using SFTP, meaning it shows up in the Files app and in the document UI of other apps.

- Shellfish supports port forwarding.

As far as I can tell, Prompt 3 still doesn’t support either of those features.

Added bonus: Shellfish lifetime unlock is only $30, compared to Prompt 3’s $100.

mayoff··on Spreadsheet "breaks" Apple Vision Pro eye-tracking
Watch the second half of WWDC 2023 session “Explore rendering for spatial computing” to see what Apple wants to tell developers about foveated rendering. Ivan never actual uses the term “foveated rendering” though.

https://developer.apple.com/wwdc23/10095

There is also an article, “Rendering at Different Rasterization Rates”:

https://developer.apple.com/documentation/metal/render_passe...

mayoff··on The Apple Vision Pro’s missing apps
He's not in the gaming space. You can find his apps here: https://underpassapp.com
mayoff··on Edsger Dijkstra carried computer science on his shoulders (2020)
Michael Snoyman has a great talk about this, “FP is the new OOP”. He argues that some major concepts that OOP popularized are now mainstream and accepted, and OOP-bashing ignores those concepts and just acts like OOP only means the bad parts.

https://youtu.be/to8ISIQjETk

mayoff··on Joining a Gym? Here's Why You Should Open a New Bank Account
It’s scammy because the gym business can very difficult unless you have people paying and not coming in.

https://medium.com/bull-market/sweaty-january-and-how-gyms-m...

mayoff··on Unusual basis types in programming languages
I also thought this was a major omission. After using languages with well-supported sum types (mainly Swift and Elm), I find it painful to go back to languages that lack native support.
mayoff··on The day I started believing in unit tests
I wouldn’t say static typing is privileged, but that testing is disadvantaged, because, in the words of Edsger Dijkstra, “Program testing can be used to show the presence of bugs, but never to show their absence!”

https://www.cs.utexas.edu/users/EWD/transcriptions/EWD02xx/E...

mayoff··on Swift was always going to be part of the OS (2022)
Yes, we pick a deployment target (a lowest supported version of iOS/macOS/etc.) at build time, and we're then allowed to use language, standard library, and SDK features that are supported by that deployment target. We can also conditionally use newer features when the app runs on a newer target, using @available and #available syntax.

Swift 6 will not change the ABI in an incompatible way. If Swift 6 introduces features that require runtime support, then code that uses those features will not back-deploy, but other code will. We have seen this before. For example, Swift 5.7 implemented SE-0309 (“Unlock existentials for all protocols”). Some of the new features of SE-0309 required runtime support, and if you wrote code that used those features, the program would not back-deploy. But (I think) the compiler emits an error if your deployment target doesn't ship with the Swift runtime that supports those features.

The big changes in Swift 6 will be new semantic restrictions related to concurrency, and possibly a small amount of breaking changes to syntax. These changes will prevent some existing Swift 5 code from compiling in Swift 6 mode. That is the reason the major version number will change.

mayoff··on TSMC demos its first 2nm chips to Apple, mass production slated for 2025
What’s interesting to me is how big the steps in process node sizes are. I thought the 5nm to 3nm step was huge—it’s a 40% reduction! And 3nm to 2nm is similar—a 33% reduction. But then I looked at wikipedia’s list of process node sizes and, well, they’ve all been 30% to 50% over more than five decades. Which is of course Moore’s law, but I figured there would be more, smaller steps.

https://en.wikipedia.org/wiki/List_of_semiconductor_scale_ex...

mayoff··on Apple unveils M3, M3 Pro, and M3 Max
You can feel slightly less bad. M2 Max was announced in January, 10 months ago.
mayoff··on Apple unveils M3, M3 Pro, and M3 Max
There's the obvious, that they want to say higher numbers.

But also, I bought a 16" MacBook Pro M1 Max when it was announced. The M2 Max replacement was announced only 15 months later and didn't seem like a big enough improvement to justify buying. Maybe they know there are a lot of M1 owners with my mindset, and we're who they're pitching.

mayoff··on Ask HN: Has anyone here learned COBOL for fun?
I wouldn’t say I learned it “for fun”, but when my sister was in college (25 years ago) as a business information systems major (or something like that), she had to take a Cobol course so I learned enough of it to help her get through the class. Next semester, she told me she had to take a second Cobol class. I told her I was done with Cobol and she switched majors.
mayoff··on Epicycle Clock
Neat!

It reminds me a little of a screen saver called Fractal Clock that I wrote many years ago for MacOS X: https://www.dqd.com/programs/FractalClock/

Sadly, the screen saver stopped working as of (I think) Catalina and I have never gotten around to fixing it. But someone else wrote a very clever web version which you can see here: https://cakenggt.github.io/web-fractal-clock/ and the source repo is here: https://github.com/cakenggt/web-fractal-clock

mayoff··on The bigger the interface, the weaker the abstraction
This lesson is applicable to lots of languages, not just Go. For example, looking at Swift (where the equivalent of an interface is a protocol), we find many protocols in the standard library that either have one function requirement, or add one function requirement to a parent protocol:

- Equatable requires ==

- Comparable extends Equatable, requires <

- Hashable extends Equatable, requires hash(into:)

- Identifiable requires id

- Encodable requires encode(to:)

- Decodable requires init(from:)

- CustomStringConvertible requires description

- LosslessStringConvertible extends CustomStringConvertible, requires init?(_:)

- CustomDebugStringConvertible requires debugDescription

- CaseIterable requires allCases

- Sequence requires makeIterator()

- IteratorProtocol requires next()

- TextOutputStream requires write(_:)

- TextOutputStreamable requires write(to:)

- CustomReflectable requires customMirror

- CustomPlaygroundDisplayConvertible requires playgroundDescription

- AsyncSequence requires makeAsyncIterator()

- AsyncIteratorProtocol requires next()

And Apple’s Swift-only frameworks also have major single-function protocols:

- SwiftUI.View requires body

- SwiftUI.Animatable requires animatableData

- SwiftUI.TimelineSchedule requires entries(from:mode:)

- SwiftUI.EnvironmentKey requires defaultValue

- Combine.Publisher requires receive(subscriber:)

- Combine.Cancellable requires cancel()

- Combine.Subscription requires request(_:)

mayoff··on Court Says It’s Fine for Cops to Use Cell Phones to Peep into People’s Cars
The actual decision was discussed days ago:

https://news.ycombinator.com/item?id=36764489

mayoff··on US vs. Poller: Ruling says police can use iPhones to circumvent tinted windows
I just tried this with my iPhone 12 mini on my cars, which were parked in my garage out of direct sunlight. I was shocked by how well it worked.
mayoff··on 34% of AP CS Students Couldn't Solve This Java-Based 2D Array Question
There’s a link to “AP Computer Science A test”, which is a PDF, and the problem in question (question 4) starts on page 14 of the PDF.

Here’s the link again: https://apcentral.collegeboard.org/media/pdf/ap23-frq-comp-s...

mayoff··on 34% of AP CS Students Couldn't Solve This Java-Based 2D Array Question
One twitter comment points out that this was the last free-response question on the exam, and that a preceding question was harder than usual. So examinees probably wasted too much time on the earlier question and lacked time to finish the last question. It doesn’t mean the last question was particularly hard.

(The twitter comment: https://twitter.com/m_litv/status/1670144278708748292)

Also, the problem should state whether the candy grid is stored row-major or column-major: is it `box[row][column]` or `box[column][row]`? As far as I can tell, that detail isn’t specified.

mayoff··on Evolution of the Scrollbar
I'm not sure why you'd call it the most ‘natural’ form. Scroll bars don't appear in nature. Of all the ways to scroll content, direct manipulation (dragging your finger directly on the document on the screen) is most like the way we move real things around in nature.
mayoff··on Evolution of the Scrollbar
This doesn't correctly simulate how mouse clicks affect Mac scroll bars. Clicking in the track outside the elevator box should move a page at a time. Maybe it's not intended to accurately simulate interaction, only appearance.
mayoff··on Supreme Court sides with Slack, putting direct listings in jeopardy
Supreme Court opinions are usually pretty easy to read. There’s also a “syllabus” that summarizes the decision, although it’s sometimes harder to understand than the opinions. Here are the syllabus and opinion for this case: https://www.law.cornell.edu/supremecourt/text/22-200
mayoff··on Negative Mass
Antimatter also has anti-color-charge. Quarks have a ‘color charge’ (unrelated to visible colors) which is ‘red’, ‘green’, or ‘blue’. An antiquark is antired, antigreen, or antiblue (and has the opposite electrical charge from its corresponding normal quark).

https://en.wikipedia.org/wiki/Color_charge

mayoff··on AOLserver is America Online's Open-Source web server (2010)
AOLserver was originally NaviServer, before AOL bought it. That’s why all of its API identifiers have the prefix `Ns_` (or `NS_` or `ns`, depending on the kind of identifier). Kind of like how (coincidentally) Apple’s Foundation and AppKit frameworks use the prefix `NS`, because those came from Nextstep.

In 1999, I was hired by ArsDigita, a web startup that used AOLserver, mainly to provide internal development and support for AOLserver. ArsDigita used big multi-CPU Sun servers (this was long before Oracle bought Sun) and I ended up diagnosing several race conditions in AOLserver that the AOL developers had trouble reproducing because they did their dev work on single-CPU boxes.

Fun fact, ArsDigita founder Philip Greenspun (of Greenspun’s Tenth Rule) knew Robert Thau from their shared alma mater MIT. Robert Thau (rst) designed and implemented Apache’s original module API. So ArsDigita hired rst to write mod_aolserver, an Apache module that provided enough of AOLserver’s API to allow running ArsDigita’s codebase (ACS) under Apache.

← PreviousPage 3 of 12Next →