Archive for April 2, 2019

Tuesday, April 2, 2019 [Tweets] [Favorites]

High Memory Use With Vapor and MySQL

Tanner (via Ilja A. Iwas):

MySQL 3.2.4 has been tagged with a fix that reduces peak memory usage by 10-15x for the sample project. See vapor/mysql#232 if you’re interested to see what was fixed.

[…]

Here’s a small recap of what went wrong, and also why it took so long to find it. The main blocker was that we initially thought this was a Linux-only memory leak[…]

[…]

The problem was not leaking memory, but overly high peak memory usage which lead to fragmentation. Which, importantly, we were also seeing on macOS. This meant it was highly likely the problem was in Vapor.

[…]

Due to optimizations in Swift’s String, Valgrind may think bytes have been “definitely lost” even though they haven’t. This seems to only happen when you stop Valgrind while it is still busy doing work.

[…]

To help prevent issues like this from happening in the future, we need to improve Vapor’s DB driver performance benchmarking. Currently, benchmarks are for small, unrealistic models and test run time only. Benchmarks that could have caught this issue early would test realistically sized models (with diverse properties and types) and also memory usage alongside run time. Implementing these benchmarks is unfortunately much easier said than done, but it’s something that has been on our list long before this issue.

Using Drag and Drop with NSTableView

Nate Thompson (via Daniel Jalkut):

I recently tried to implement drag and drop with NSTableView in a project and ran into a bunch of issues with finding resources that actually helped. Such is the life of a Cocoa developer. So here’s my attempt at the definitive guide to drag and drop with NSTableView. (This should also apply to NSOutlineView, since they work in a similar way.)

[…]

There’s a bug in NSTableView that requires implementing tableView(_:heightOfRow:) to get the gap style to animate correctly.

[…]

Passing -1 and on will highlight the entire table view.

Unfortunately, I have not found that highlighting to be reliable since macOS 10.14.

Withholding AppleCare

Nigel Kersten:

I don’t think I’ve ever really told the story on Twitter about the time Steve Jobs sent me a polite but dismissive email and then proceeded to make my life at work rather hellish.

[…]

So these new Macs came out and you couldn’t run OSX 10.3.9 on them, only 10.4.x

But Pro Tools wouldn’t run on 10.4 and digidesign were not looking like they’d have support ready before the start of the school year.

So I started poking at 10.3.x to see if I could fix it.

[…]

I get a phone call from AppleCare

“Hi I have to tell you that if you run those computer labs on OS X 10.3 we’re not going to honor your warranties for any of your Macs. Been told to tell you. Bye”

Kickstarting Watch App Development

Pádraig Kennedy:

The single biggest thing Apple could do to kickstart Watch app development imho is to sell developer units that you can connect to directly with a wire, just like the ones Apple uses to do watch app development.

(I made one of our developers work on the watch for a week and I feel guilty and am trying to figure out how to make it up to them.)

Marco Arment has made similar comments. The more unpleasant an area of development is, the more people will want to do something else instead.

Joe Cieplinski:

I second this suggestion. Wireless debugging of watch apps is still a nightmare.

Previously:

Falsehoods About Time and CSVs

Zach Holman:

I’ve made notes of the egregious things I’ve learned about programming with time and pulled them together as a talk. This is the written companion piece, which is sort of a super set of the talk, since I had way more notes than what I could shove in a single talk.

Beyond that, though, there’s also a lot about time itself that is properly hilarious, and it’d be a travesty to not talk about the country that recently decided to skip a certain day, or that the Unix epoch isn’t technically the number of seconds since January 1970, or that February 30 happened at least twice in history.

Jesse Donat (Hacker News):

Much of my professional work for the last 10+ years has revolved around handling, importing and exporting CSV files. CSV files are frustratingly misunderstood, abused, and most of all underspecified. While RFC4180 exists, it is far from definitive and goes largely ignored.

Partially as a companion piece to my recent post about how CSV is an encoding nightmare, and partially an expression of frustration, I've decided to make a list of falsehoods programmers believe about CSVs. I recommend my previous post for a more in-depth coverage on the pains of CSVs encodings and how the default tooling (Excel) will ruin your day.

Previously: