HNHacker News
TopNewBestAskShowJobs

sirn

3,953 karma · joined October 25, 2009

Contact: sirn@ogsite.net

Software developer living in Tokyo, Japan

Previous: Oozou (BKK), Omise (BKK→TYO), Varnish Software (TYO), EnergyRoute Japan (TYO)

I run a small IT consulting business in Japan; feel free to email.

submissionscomments
sirn··on Deep Diving into the Strengths of FreeBSD
I hosted my coding environment on a VPS running FreeBSD and happen to jump between VPS provider quite a bit due to location and pricing. My migration method was simply:

    $ zfs snapshot zroot/home@migrate
    $ zfs send -R zroot/home@migrate | ssh newhost zfs recv zroot/home
ZFS automatic snapshots (via zfstools[1]) can also saved hours of headaches trying to recover an older version of a file. Since snapshot appears as a regular mount (ZFS even automatically expose them under /path/to/mount/.zfs/snapshot), all existing tooling just works (cp, cat, running diff against snapshot, etc.).

My Linux machine these days also runs ZFS, but the level of integration with the system is still far from that of FreeBSD's. That can range from something as simple as ZFS ARC stats in top, to native support for ZFS Boot Environment allowing the system to boot directly from snapshots or do an offline upgrade of a clone of a live system[2]. (On Linux side of things there's zfsbootmenu[3] which provides something similar but the project is still quite new.)

The filesystem may not matter that much, and I'm sure many these features can be replicated with LVM, but having a unified tooling and community around it really makes quite a difference in quality of life as an end-user.

[1]: https://github.com/bdrewery/zfstools

[2]: https://vermaden.wordpress.com/2021/02/23/upgrade-freebsd-wi...

[3]: https://zfsbootmenu.org/

sirn··on India’s second wave of Covid-19 feels nothing like its first
The 3 days quarantine is only for people arriving from a list of countries with a known mutated strain. It's much less strict if the passenger did not arrived from the listed countries ([1]; the one in the parenthesis, the table below is countries which PCR result is required).

Officially the rule is to be quarantine in the designated place for 14 days and to report everyday. However, the loophole is the designated place also includes your home, and if you happen to use LINE, the daily report becomes just a button press in the app. Location tracking is only recommended, not required. (The Japanese document on location tracking is just to enable location history on Google Maps or enable Significant Location on iPhone[2])

[1]: https://www.mhlw.go.jp/stf/seisakunitsuite/bunya/kenkou_iryo... Note the English version of this document is very outdated (Mar 26, 2020 for the English version vs. Mar 21, 2021 for the Japanese version.) See [3] for a more up-to-date one, although in a different format.

[2]: https://www.mhlw.go.jp/content/000652555.pdf

[3]: https://www.mofa.go.jp/ca/fna/page4e_001053.html The list is in Section 2, in the (Note 1), with the most horrendous formatting possible.

sirn··on Last Resort Font (2002)
Apple gave LastResort to Unicode Consortium back in 2008[1].

Big Sur currently shipped with version 13.0, so presumably it's the same font (version info obtainable by running `system_profiler SPFontsDataType`).

[1]: https://www.unicode.org/mail-arch/unicode-ml/y2008-m06/0019....

sirn··on iPad Pro M1
Just a wishful thinking, but since this is an M1 and not the A14X (and 8c+8c+8/16GB setup used in MacBook Pro even), I'm hoping that Hypervisor.framework will come to an iPadOS in the next WWDC. Having something like macOS.app, or even Ubuntu.app within iPad Pro would make it a pretty amazing convertible (for me).
sirn··on Vgpu_unlock: Unlock vGPU functionality for consumer grade GPUs
The OP is referring to GPU passthrough setup[1], which passes through a GPU from Linux host to Windows guest (e.g. for gaming). This is done by detaching the GPU from the host and pass it to the VM, thus most setup requires two GPUs since one need to remain with the host (although single GPU passthrough is also possible).

Nvidia used to detect if the host is a VM and return error code 43 blocking them from being used (for market segmentation between GeForce and Quadro). This is usually solved by either patching VBIOS or hiding KVM from the guest, but it was painful and unreliable. Nvidia removed this limitation with RTX 30 series.

This vGPU feature unlock (TFA) would allow GPU to be virtualized without requiring the GPU to first be detached from the host, vastly simplify the setup and open up the possibility of having multiple VMs running on a single GPU, all with its own dedicated vGPU.

[1]: https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVM...

sirn··on ISO 8601: a better date format
I think the main usage of ISO 8601 was to represent a point in time in UTC for exchange, not a local time plus timezone. When a date such as 2021-02-26 18:38:00+0900 is provided, it did not meant 2021-02-26 18:38:00 in Asia/Tokyo, but meant 2021-02-26 09:38:00 in UTC. e.g., 09:38:00Z and 18:38:00+0900 and 16:38:00+0700 were supposed to be equivalent.

In this case, timezone is external to this format and the timestamp can be calculate back to UTC without relying on zoneinfo (which is very useful for exchange). Any further conversation would be external to this format. e.g., in case of calendar, it's probably more useful to have datetime in local timezone rather than of the other party's timezone so the tuple would be (utc_time, local_tz) rather than (other_localtime, other_tz, local_tz).

sirn··on ISO 8601: a better date format
I think because it would defeat the portability of a timestamp because Asia/Tokyo isn't constant and you cannot lookup the offset without relying on external database that takes in ("2021-02-26 18:38:00", "Asia/Tokyo") as a parameter. Offset in zoneinfo changes depending on day of a year, and sometimes even hour of a day, and the database of timezone is constantly updated (latest zoneinfo is version 2021a).

So while having 2021-02-26 18:38:00 Asia/Tokyo as a timestamp would more accurately represent the time, it would create another set of issues, namely requiring a database to look it up, and requiring to keep those database in sync in all systems in the world. Having both may be redundant because in that case you can't still trust the offset.

There are alternative systems such as TAI64[1] based on TAI[2] that are meant to accurately represent the moment in time without being subjected to leap second (only account them on conversion to UTC). The main issue is TAI64 is not really human readable (e.g. @4000000037c219bf2ef02e94) and would still require database of leap seconds to accurately convert back to UTC.

[1]: http://cr.yp.to/libtai/tai64.html

[2]: https://en.m.wikipedia.org/wiki/International_Atomic_Time

sirn··on ISO 8601: a better date format
金 from 金曜日 (Kinyōbi) means Friday. The letter correspond to the planet the weekday was named after, just like in English (金星 is Venus)
sirn··on Show HN: QEMU front end for M1 and Intel Macs
Also worth mentioning that UTM developers has been contribution patches to QEMU to get TCG (code emulation layer) to work under iOS / M1 Mac[1] as well (whereas I think TCG is still broken as of latest QEMU release due to mprotect[2]). So huge, huge thanks for this as well!

[1]: https://lore.kernel.org/qemu-devel/20210126012457.39046-1-j@...

[2]: https://lore.kernel.org/qemu-devel/161259505296.24527.772997...

sirn··on M1 Mac owners are experiencing high SSD writes over short periods of time
Adding to the data point, this is my 16GB Mac Mini 1TB I've been using as a primary computer since December (so ~3 months). I have been doing some development on this machine as well as porting packages for ARM for MacPorts. I also have Syncthing and Time Machine running.

    Available Spare:                    100%
    Available Spare Threshold:          99%
    Percentage Used:                    0%
    Data Units Read:                    9,664,566 [4.94 TB]
    Data Units Written:                 5,755,588 [2.94 TB]
This sounds to me like a write amplification issue caused by some software as mentioned elsewhere in the thread (first party or third party).
sirn··on Migrating to SQLAlchemy 2.0
In SQLAlchemy, you can choose to use only the query builder without using the ORM part at all. The query builder in SQLAlchemy is very well documented[1] and its use without ORM has the same level of support as its ORM counterpart. SQLAlchemy call their query builder a SQL Expression Language[2], e.g.

    # Boilerplate
    from sqlalchemy import create_engine, MetaData, Table
    engine = create_engine('sqlite:///:memory:', echo=True)
    metadata = MetaData()

    customers = Table('customers', metadata, autoload_with=engine)
    query = customers.select([customers.c.id, customers.c.fname, customers.c.lname, customers.c.phone])
    # => SELECT customers.id, customers.fname, customers.lname, customers.phone FROM customers

    conn = engine.connect()
    conn.execute(query)
    # => [(1, "Foo", "Bar", "12345678"), ...]
ActiveRecord also has Arel which can be use as a standalone. Documentation is a bit more sparse compared to SQLAlchemy Core or its ActiveRecord ORM counterpart, though.

[1]: https://docs.sqlalchemy.org/en/13/index.html

[1]: https://docs.sqlalchemy.org/en/13/core/tutorial.html

sirn··on Migrating to SQLAlchemy 2.0
I think this is fundamental design difference between SQLAlchemy and ActiveRecord in general. SQLAlchemy uses Data Mapper pattern which does not necessary map 1:1 to the row in the database, so you have to deal with the whole (Object, Mapper, Data) tuple instead of just Object in case of Active Record pattern (of which Rails' ActiveRecord were based on).

This means SQLAlchemy does not try to hide away SQL, which is beneficial in dealing with complex queries. In Rails ActiveRecord you could use arel in such case but being a query builder it lose the benefit of ActiveRecord, whereas in SQLAlchemy it could be done relatively easily within the ORM layer (arel equivalent in SQLAlchemy would be its Expression Language). On the other hand, some things that are complicated in ActiveRecord can also be trivial to implement in SQLAlchemy (e.g., column_property[1])

[1]: https://docs.sqlalchemy.org/en/13/orm/mapped_sql_expr.html

sirn··on Migrating to SQLAlchemy 2.0
There have been so many times where I started a new project in a new shiny language and ended up coming back to Python because I love SQLAlchemy (and Pyramid) way too much. It's one of the few ORMs out there that doesn't hate you for liking SQL.
sirn··on Requests dropped when using Cloudflare’s free tier for a commercial project
I've been using Cloudflare for a site that has around 400k requests per day on a Free plan (although I did buy a dedicated certificate and a domain from them) and Cloudflare has been very reliable to me except few hiccups in the past. I've had an instance of Cloudflare failing only on a single region, but after talking to support it turns out to be some route caching issue on their side, which subsequently fixed. I would not assume anything until there's some clarification on Cloudflare side. It might just be a bug.
sirn··on Homebrew 3.0
Ah, you're right. Now thinking back, I think it was how Homebrew reuse system libraries that make it a better experience than MacPorts at the time since it could cut over half of the building time (it prevent the situation where `port install sl` ended up having to build the entire gcc toolchain). This was actually why "reuse system library" were such a big deal back then. Bottle come much later than that.
sirn··on Homebrew 3.0
I think what I meant was darwin failure doesn't block.

Recently I had nomad breakage on -unstable caused by nvml support, which pulls in nvidia_x11, which pulls in linux_5_4, which of course not installable on darwin[1]. The maintainer fixed it very quickly (thank you!) but I still need to wait few more days for it to be included in -unstable.

[1]: https://github.com/NixOS/nixpkgs/issues/108603

sirn··on Homebrew 3.0
That's fair, but it's only affecting single user, while writable /usr/local affects all users. However most Mac users are single user, so the tradeoff makes sense in this context.
sirn··on Homebrew 3.0
Those were one of the reasons, but I believe the biggest reason was MacPorts didn't install from binary archive and requires building everything from source in its early days (in the old BSD port tradition). Binary archives were added to MacPorts in 2011 with MacPorts 2.0, but a lot of people (me included) has already moved to Homebrew, leaving MacPorts with an impression of old, slow, and make your Mac fry an egg.

MacPorts these days behaves similar to Homebrew by installing from binary archives by default and only build from source when binary archive is not available. This vastly improved the experience, but the old impression remains for those who got burned (literally for some) by MacPorts. 10 years is a long time, and MacPorts has improved a lot since then.

sirn··on Homebrew 3.0
> Like Homebrew does not need elevated privileges to work and actively discourages it

It does this by chowning /usr/local to a local user, which is worse for security than running sudo because now any malicious process can overwrite /usr/local/bin/bash without asking for privileges. macOS having /usr/local/bin in its $PATH by default also doesn't help. Homebrew made this security vs usability tradeoff because most Mac users are a single user, which makes sense in its context.

The recent change of moving Homebrew to /opt/homebrew (at least for M1 Mac) is a better solution for this as it is no longer in the default $PATH. On the other hand, MacPorts approach of requiring sudo allows it to drop privileges to other unprivileged non-admin user (macports) during build in addition to building everything via sandbox-exec.

sirn··on Homebrew 3.0
Unfortunately, Nixpkg doesn't check buildability on Darwin when merging PRs, so things can break quite often on the nixpkgs-unstable channel (compared to nixpkgs-unstable on Linux). It's not hard to rollback, though, but it does makes me never want to ever run `nix-channel --update`.
sirn··on Homebrew 3.0
Jordan Hubbard was involved in the creation of both FreeBSD Ports and MacPorts (DarwinPort), so it makes sense that it shares the BSD ways of doing things. His decision to use Tcl for MacPorts also came from his experience dealing with Makefiles[1]

[1]: https://netbsd.org/gallery/10years.html#hubbard

sirn··on Changes to Homebrew adversely affect Python development
MacPorts binary archives were added back in 2011 across all three architectures at the time (ppc, i386, x86_64). Some packages are still maintained for ppc even today.
sirn··on Changes to Homebrew adversely affect Python development
asdf[1] mentioned in the article is similar to anyenv but instead of being a wrapper around *env, it implements its own simple framework for creating a version manager (e.g. [2]). Usually asdf plugin uses the same underlying installer as its *env equivalent (e.g. asdf-python uses python-build, asdf-ruby uses ruby-build, asdf-erlang uses kerl).

[1]: https://asdf-vm.com/

[1]: https://asdf-vm.com/#/plugins-all

sirn··on Changes to Homebrew adversely affect Python development
Not only that, MacPorts also kept all versions installed even after upgrade unless it's explicitly uninstalled (port echo inactive / port uninstall inactive); suffix every binaries with versions by default (e.g. pip-3.8, ansible-3.8) and only linked them as unversioned when explicitly set (port select --set python3 python38) which should be more familiar to people coming from Linux/BSD world.

I wish more people try out MacPorts.

sirn··on Linux Ported to the M1
> then he argues that anyone shipping source in tarballs is noncompliant:

I think he might be referring to the section 2a of GPLv2 (5a of GPLv3) which require keeping track of modifications to the source code. I've never seen this clause being enforced, though. (IANAL)

I also wishes there were some sort of collaboration rather than an outright dismissal.

sirn··on Linux Ported to the M1
I believe this is the reason:

> They, however, embed linux-apfs into their single-commit dump, without full credit, which is a copyright violation. I thought it was their code until I found the original history.

> That tells me that they do not care to respect authorship information for open source code they incorporate, and thus makes me extremely wary that they may have also copied Apple code as part of their port. Licensing is something you have to take seriously.

https://twitter.com/marcan42/status/1350382593510817795

sirn··on M1 Macs cannot support dual Extended displays through their Thunderbolt 3 ports
That indeed could work, and it looks like Belkin's Thunderbolt 3 Express Dock HD[1] actually does this. Though in this case, Thunderbolt is limited to just 2 (1 for downstream and 1 for upstream).

I guess the biggest benefit of USB 4 hub is that allows the hub to have more than 2 Thunderbolt ports (the upcoming OWC Thunderbolt hub has 1 upstream and 3 downstream) and no longer have to worry about unplugging a device breaking a chain (usability problem).

[1]: https://www.belkin.com/us/p/P-F4U095/

sirn··on M1 Macs cannot support dual Extended displays through their Thunderbolt 3 ports
My understanding is that daisy chaining doesn't require a mixed USB and Thunderbolt signal, only Thunderbolt. Before USB 4, USB-C spec itself disallows hubs to passthrough an Alternate Mode and even Thunderbolt daisy chain also have to terminate at any point where USB is plugged in. In this case, I believe you can have Thunderbolt 3 hub that only carries Thunderbolt signal, but it will only work with Thunderbolt devices and not USB-C.
sirn··on M1 Macs cannot support dual Extended displays through their Thunderbolt 3 ports
Before USB 4, USB-C spec itself say "see also USB 3.1" for USB hubs and disallow passing through Alternate Modes (e.g. Thunderbolt/DisplayPort) or Accessory Modes (e.g. audio dongle) which vastly limited the usability of USB-C port. USB 4 introduces a new discovery protocol with added support for passing through Alternate Mode in USB-C spec (as long as downstream is also USB 4).
sirn··on M1 Macs cannot support dual Extended displays through their Thunderbolt 3 ports
Ah. I sit about 60~80cm away most of the time from my bigger 4K screen (due to the space needed for my Cintiq when I'm drawing). I tried several resolution after your previous comment and found 2048x1152 to have the best balance between real estate and readability at my viewing distance. I should give this a try for few days. Thank you for suggesting to have a look at the resolution!
← PreviousPage 5 of 29Next →