HNHacker News
TopNewBestAskShowJobs

david_allison

2,123 karma · joined June 21, 2020

maintainer @ AnkiDroid

https://github.com/david-allison

gmail: davidallisongithub

Sponsors: https://github.com/sponsors/david-allison/

https://opencollective.com/ankidroid

submissionscomments
david_allison··on A live ranking of airlines by how much luggage they are losing
They're flag emoji, which Windows doesn't display (likely for political reasons)
david_allison··on Duff's Device and Coroutines (2008)
Manually performing loop unrolling:

https://en.wikipedia.org/wiki/Duff%27s_device

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

david_allison··on I Add 3-25 Seconds of Latency to Every Page I Visit (2020)
Is there an up-to-date tutorial on how to do this in Chrome?
david_allison··on I kind of like rebasing
For what it's worth, I often look at commits/commit messages in-depth.

I wouldn't do so if the history were a mess

david_allison··on Java string interpolation feature has been cancelled
https://news.ycombinator.com/item?id=38964824 [JEP draft: String Templates (Final)] - 5 months ago

----

I'll stand by my past point that it was unnecessarily verbose. I'm really glad they're going back to the drawing board with it

david_allison··on Show HN: Unforget, the note-taking app I always wanted: offline first, encrypted
* It's cross-platform

* It's (probably) sandboxed

* It's easy to distribute

* It's easier to make an app with a decent (but non-native) UI, compared to other cross-platform toolkits

david_allison··on My favorite programming problem to teach: Digit length (2019)
Was asked this one years back in a university interview. Fantastic problem
david_allison··on Arm64 on GitHub Actions
Excuse my ignorance, isn't `runs-on: macos-14` ARM64-based (M1)

https://github.blog/changelog/2024-01-30-github-actions-maco...

david_allison··on How to make a great government website
Likely the Good Friday Agreement: https://en.wikipedia.org/wiki/Good_Friday_Agreement
david_allison··on I am sick of LeetCode-style interviews
> Even though Eclipse does it, I'm sure you know where HashMap lives.

Why?

----

I'd struggle. It's a trivia question as it has no bearing on modern Java development

Modern IDEs both collapse the import section, and auto-import on the fly

The only reason I'd see the line is:

* Looking up documentation: very rare

* Conflict on the import - unlikely

* Code Reviews - skimmed over

david_allison··on Stuck at sea for years, a sailor's plight highlights a surge in ship abandonment
FTA: Even if they did sell the ship, it often won't make the workers whole

> Abandoned ships are sometimes so old and worn that “even the scrap guys lose money stripping it of anything of value,” said Eric White, a ship inspector for the International Transport Workers’ Federation, or ITF, a seafarers’ union.

> Left hanging by Teeters were the ships’ crews of mostly Ukrainian seafarers, who suddenly had no way of sending money to families back home in what was now a war zone after Russia’s invasion. In total, the 22 men were owed $130,000 covering more than three months, White said. If not for $22,000 in donations from local seafarers’ charities, none of them would have made it off the ship and back home, according to White.

david_allison··on Why am I dreaming I have an exam I didn't study for?
Sounds like a mild form of PTSD
david_allison··on Big data is dead (2023)
https://yourdatafitsinram.net/
david_allison··on We're ending our Samsung collaboration
Xiaomi ran an obvious wiretap on the phone's network activity when I last looked [start of 2022].

Google:

/storage/emulated/0/MIUI/debug_log/common/tcpdump

david_allison··on Ask HN: Why are comments here overwhelmingly critical?
It's a de-facto rule that you shouldn't post "good job": comments should add to a discussion, "good job" adds little value and should be an upvote instead.

This means conversations skew to be constructive/critical/negative.

david_allison··on What UI density means and how to design for it
Chinese is a much more dense language than English, so you need less space for labels.
david_allison··on What UI density means and how to design for it
Mobile apps are constrained by accessibility (touch target minimum size), so you probably won't see the density renaissance you're hoping for.
david_allison··on Don't use pixelation for redacting text (2022)
That leaks the length of the text
david_allison··on British engineering giant Arup revealed as $25M deepfake scam victim
$10k/week in crypto lets you easily 'hack' a random corporate account
david_allison··on Google Blog: things we announced at I/O 2024
Yes; barely; most of it
david_allison··on Becoming an Amateur Polyglot
Anki has two types of hint fields (and the CSS/JavaScript in Note Types is editable, so you can add your own functionality if this is insufficient)

* https://docs.ankiweb.net/templates/fields.html#hint-fields

* https://docs.ankiweb.net/editing.html#cloze-deletion:~:text=...

Disclaimer: AnkiDroid maintainer

david_allison··on So We've Got a Memory Leak
Additionally, `using` no longer requires indentation in C#

https://learn.microsoft.com/en-us/dotnet/csharp/language-ref...

david_allison··on Has Generative AI Already Peaked? [video]
Paper discussion: https://news.ycombinator.com/item?id=40307832
david_allison··on Most to least common 4-digit PIN numbers from an analysis of 3.4M
PINs, not PIN numbers. The N in PIN stands for number.

This is an instance of RAS syndrome: https://en.wikipedia.org/wiki/RAS_syndrome

david_allison··on Ontario family doctor says new AI notetaking saved her job
Med students don't have the time to make Anki cards
david_allison··on The greatest resume I've ever seen
(2021), site is now offline: https://dsresume.com/

Snapshot (Sept 30, 2021): https://web.archive.org/web/20210930190513/https://dsresume....

david_allison··on A bug that spoke Russian and crashed my app
Limiting, but it looks like a valid solution. Android's native i18n is a mess.

We went down the route of duplicating strings between `/values-heb` and `/values-iw` to fix the platform issues, even though the change from `iw` -> `heb` was enacted in ISO 639:1989.[0]

OP's change is questionable in that it may block regional dialects: `[zh-CN, zh-TW]; [pt-PT, pt-BR]` in case the system default is set incorrectly, but it will suffice for most Android apps which will realistically only be in a small subset of 'easy' languages.

[0] https://xml.coverpages.org/iso639a.html (revised 1989)

david_allison··on A bug that spoke Russian and crashed my app
> (What even is the point of doing `Locale.setDefault()` with the same Locale that `Locale.getDefault()` returned? I don't know anything about Android.)

The code intends to trim the country, variant and any extensions from the value returned from `Locale.getDefault()`

Example: "Chinese (Traditional) - Taiwan" to "Chinese"

Pseudocode:

`zh_Hant_TW` -> `zh`

It also normalizes to fix some Android internal mapping issues due to changes in ISO 639 (Hebrew can be `iw` or `he[b]`)

david_allison··on A bug that spoke Russian and crashed my app
This isn't fixed properly

The linked code is:

        String languageCode = Locale.getDefault().getDisplayLanguage();
        Locale locale = new Locale(languageCode);
        Locale.setDefault(locale);
But `getDisplayLanguage()` is defined as returning the display name, not the language code:

> if the locale is en_US and the default DISPLAY locale is fr_FR, getDisplayLanguage() will return "anglais"

https://developer.android.com/reference/java/util/Locale#get...()

----

This then proceeds to create a locale with a corrupt language code. The language parameter of `Locale` is not validated (besides a null check), and using a corrupt Locale in `Locale.setDefault()` will cause a number of bugs

david_allison··on Flags Are Not Languages
* Use 文A, and ensure you can navigate to the menu only via symbols

* The first element should be "use default/system language"

* Language names should be displayed untranslated: "Deutsch, English, français"

* Optionally display the language in the currently selected language

← PreviousPage 6 of 24Next →