HNHacker News
TopNewBestAskShowJobs

grose

1,642 karma · joined June 13, 2012

backend dev @ tokyo github.com/guregu

email greg at toki.waseda.jp

submissionscomments
grose··on The LaserDisc
There's a small, CD sized version of the LaserDisc called CD Video (also a related format called Video Single Disc). I've always wondered whether it would be possible to use CD-Rs to make one. Could CD burners somehow be coaxed to write the analog data for the video? It can only fit 5 minutes of video but I think vaporwave artists would love it, and it could keep the format 'alive' with the first new content in decades.

https://en.wikipedia.org/wiki/CD_Video https://en.wikipedia.org/wiki/Video_Single_Disc

grose··on HTML Attributes vs. DOM Properties
Great article. Maybe a hot take but I think it's a good thing that dialog and details modify the DOM. It allows for UI state to be serialized and stored in a native way. I think input.value should work the same way too (although it's probably too late for that). Consider how some browsers will remember what you input into forms when you hit the back button: I think representing this as a cached version of the modified DOM makes a lot more sense than whatever magic browsers currently use to remember it. Many CSS pseudoclasses like :checked feel like a pre-attribute-selector bandaid.
grose··on JSR: The JavaScript Registry
Excellent, this will make my life easier. Thanks!
grose··on JSR: The JavaScript Registry
What's the best way to include a binary blob (wasm binary) in your package? For NPM I've been using a bundler (esbuild's `binary` loader) but I'm not sure of the best way to do that in a modern, jsr-friendly way.
grose··on Jank-Free Image Loads (2018)
The intrinsicsize attribute was abandoned in favor of tweaking the way browsers handle the size attribute, iirc. These days it seems to just work if you give it the actual size there. aspect-ratio did make it and was added to CSS, yay. Very handy attribute.
grose··on The Uncomfortable – a collection of deliberately inconvenient objects
Site is down, so Archive link: https://web.archive.org/web/20240114144504/https://www.theun...
grose··on Is Fortran “A Dead Language”? (2022)
While Prolog is niche it's still alive and kicking IMO. The go-to example for a 'modern' project is TerminusDB. I'm currently using Prolog for a greenfield expert system project at $work. There's been a bit of a Datalog resurgence as well, you can see it in the Biscuit authz system for example. As a fundamental pillar of logic programming, I don't think it will ever die (akin to Lisp and functional programming). Pure speculation here but I think we might see more interest towards symbolic AI in the coming years coupled with LLMs to ground answers against well-defined knowledge bases, as a sort of anti-hallucination measure.
grose··on Your last name contains invalid characters (2010)
I live in Japan and this happens to me all the time. My name is too long to fit in most forms so I have to drop the middle name (which isn’t really a thing here, they consider it as part of my first name), and then they get mad at me because it doesn’t match my ID exactly. I’ve had to redo forms because I didn’t write my name in all caps like the resident card. I’ve had medical ID cards from hospitals that chop my name halfway off and the staff wrote the rest with a marker. It’s a mess.
grose··on Mario Maker 2 API
Archive: https://web.archive.org/web/20240108181325/https://tgrcode.c...

Followup post: https://web.archive.org/web/20230811134158/https://tgrcode.c...

grose··on Things engineers believe about Web development
I believe Figma is indeed written in C++ and uses emscripten. It's pretty much the polar opposite of your standard CRUD app.

Old article: https://www.figma.com/blog/webassembly-cut-figmas-load-time-...

grose··on Ambient Co-Presence
I run a smallish private forum (~4k MAU but pretty active). My philosophy for the real-time stuff is to update anything that can be updated without being distracting. On the thread list, the number of replies will update in real time but the threads won't move position (be bumped) until you refresh. Threads with at least 2 people reading them will have a subtle highlight that users can configure, this lets you know you have a decent chance someone will see your reply immediately; this fades in and out in real time too. New replies show up instantly inside of a thread (and so do edits and deletions). There's a real-time 'N users are currently viewing' counter for threads and the whole site at the bottom of the page but it doesn't tell you who is viewing it -- I think that's kind of a privacy violation and might discourage people from clicking around. I think the combination of these features lets users know the site is alive without feeling like a panopticon.
grose··on Wasmer JavaScript SDK
Thank you as well! I am looking forward to it, will keep an eye out & would be happy to test. I know it's difficult to keep the packages small, I struggle with it for sure (e.g. currently I use Wizer to optimize my startup times, but that also takes a significant chunk of the bundle).
grose··on Wasmer JavaScript SDK
I use @wasmer/wasi for my npm package `trealla` (wasm port of a Prolog interpreter). For the most part I'm pretty happy with it, but the file size is quite large[1] (taking up around half my bundle size), and it looks like @wasmer/sdk is even larger (wasmer.sh downloads a 1.7MB gzipped wasm binary that I assume is the runtime). It's a tough sell to the frontend folks when my package is this big... currently I have my eye on jco[2] which I hope will be much lighter.

No shade intended towards the Wasmer folks, I appreciate the work they've done.

[1]: https://bundlephobia.com/package/@wasmer/wasi@1.2.2

[2]: https://github.com/bytecodealliance/jco

grose··on Go Testing by Example [video]
You can find which parts of the code are untested like this:

    go test -coverprofile=cover.out && go tool cover -html=cover.out
grose··on Gobs of data (2011)
That's interesting because I've had basically the opposite experience. I used encoding/json with BadgerDB and saw that json.Unmarshal in a hot loop was using about 68% of total CPU time in a profile taken from production. By switching to gob it significantly decreased to around 28% (for gob's decode function). I've read that decoding interfaces in gob is slow[1], maybe that accounts for my difference as I don't have any in this particular struct. Also this was a very read-heavy service, so that could be a major difference as well.

[1]: https://groups.google.com/g/golang-nuts/c/12qhqiG1J70

grose··on Hidden manuals: gittutorial, giteveryday, gitglossary, gitworkflow
`man ascii` changed my life. No more ad-ridden ascii table websites. Glorious.
grose··on Htmx, Rust and Shuttle: A New Rapid Prototyping Stack
htmx isn't supposed to replace templating engines, it's supposed to provide the "last mile" to make your SSR pages (usually rendered with some template engine) more dynamic.

I think it's a good idea. I have been writing vanilla JS for SSR'd pages for a while and inevitably reimplement some common patterns over and over (such as "load another page, select part of it, replace part of current page"), of which htmx looks to do a good job of capturing.

grose··on Should you use a Lambda Monolith, a.k.a. Lambdalith, for your API?
I like to use it for little side projects, then I can leave them alone forever and not have to shut them down.
grose··on Unwrapit provides a way to handle errors in JS/TS
Whoa, these docs are really nice. Love how it includes the functional Haskellish signature, TS signature, and useful examples for each. Props to the authors.
grose··on Research Unix Sixth Edition (WASM)
Sent a PR with a fix. The problem is that it was relying on the keydown event which Android Chrome doesn't send. Tweaked it to also handle the event input and it seems to work.
grose··on Research Unix Sixth Edition (WASM)
OK, thanks. I was able to reproduce it on an Android 11 emulator. I'll take a look. I brought up the tty thing because on iOS it scrolls everything offscreen but input works.
grose··on Research Unix Sixth Edition (WASM)
Try clicking the tty1-8 buttons, it should pop up a keyboard (but will scroll you to a weird place). I just sent a patch that should fix the scrolling behavior after a tty switch: https://github.com/rsc/unix/pull/1

If you have a different problem, post your OS/browser so we can try debugging it.

grose··on Ask HN: How to do transactional SMS as a bootstrapped or startup company?
For your use case I think e-mail is the best option. One scrappy alternative I've used with success in the past is to use a messaging app like Telegram. I needed push notifications for a small website but all the "Push apps" (like Pushover) that I found were quite expensive. Telegram is free with a simple but powerful API. However, this is only viable if your users are either from a country that already uses said app a lot, or like your site enough that they are willing to download an extra app for it. I wouldn't recommend it as a required thing but only a bonus. Now that browsers support push I've been using that, but for iOS it's still a bit painful and doesn't play well with my site that uses many subdomains.
grose··on Banging errors in Go
Oh yeah, I’m not seriously suggesting !! as a new language feature, just recommending it as an alternative to the article’s (!fn() and ^fn()). The reason for “abusing” these pre-existing syntaxes is so that you can take advantage of the official parser and AST package. Makes it easier to play around with. If Go were to ever actually add this feature, they definitely should use a new keyword or symbol.
grose··on Banging errors in Go
Indeed. What I meant is that compared to the pre-existing error handling, there are use cases it won’t fit. I am pro-? syntax. I think it would be useful even without being able to add context, but I’m also interested to see if there are solutions that could handle this for you.
grose··on Banging errors in Go
I love weird little experiments like this! I was in favor of the check-handle proposal[1] that landed at the same time as the generics proposal and a little sad that it seems to be abandoned.

Bikeshed: How about _two_ bangs?

        data := !!io.ReadAll(zd)
The double-bang pattern is unused in Go because it doesn't coerce non-booleans to booleans, so you can appropriate it without stepping on anyone's toes :)

The main disadvantage of a Rust-?-like syntax for Go is you lose the ability to add context to the error (e.g. wrapping with `fmt.Errorf("context goes here: %w", err)`). Some people prefer to shove a stack trace inside the error to work around this. I'm not sure what the perfect solution would be. The check-handle proposal adds a special handle keyword to deal with it.

BTW, I am aware of the 'errors are values' concept -- I was the guy interpreting for Rob Pike and the nice Japanese fellow who asked him about it at a conference afterparty and inspired the blog post. I think this pattern is great but it's quite hard to distill it into generic advice ("delay reporting errors until the last possible moment"?). Designing ergonomic APIs for Go can be challenging, and purely anecdotally a lot of the proprietary Go code I've seen at various companies does not do a great job at it.

My #1 wish for Go is that one day Go will figure out sum types and pattern matching. I know that the way interfaces work make this challenging, but I have hope. Using sum types to handle errors makes it much more obvious what the 'right thing' to do is.

[1]: https://go.googlesource.com/proposal/+/master/design/go2draf...

grose··on What is wrong with TOML? (2019)
I think syntax typing is a good idea. There are a million ways to format dates and standardizing that saves a lot of pain. Having explicit syntax for types means it's easier to handle arbitrary data or data of an unknown schema, and without it you are forced to assume everything is a string or rely on heuristics which leads to divergent implementations.

No semantic whitespace please. Can't tell you how many times I've seen something in GitHub Actions or similar get messed up because someone forgot a space.

I don't think TOML is a perfect format and agree it's not great at hierarchies.

grose··on The Power of Prolog
For Node, check out trealla-js: https://github.com/guregu/trealla-js. I tried to make it as easy to embed as possible.

This paper is also very interesting. It describes the Janus System, a deep integration between Python and Prolog: https://arxiv.org/pdf/2308.15893v1.pdf

grose··on Neopets is still around
Neopets taught me HTML. I might have never become a developer without it. It’s crazy to think that letting kids shove some raw HTML into a text box could change lives. I bet MySpace has similar stories.
grose··on Are any words the same in all languages?
Mama and papa are used in Japan too. See constructions like “mama-tomo” (“mom friends”) and “papa-katsu” (“sugar daddy”).
← PreviousPage 2 of 8Next →