HNHacker News
TopNewBestAskShowJobs

jez

4,090 karma · joined February 23, 2014

- http://blog.jez.io

- https://github.com/jez

- https://jez.io

[ my public key: https://keybase.io/jez_; my proof: https://keybase.io/jez_/sigs/s9uEJ_STwo02blZ-iSkntb4jURsdxhKkc8rg5Y_9im8 ]

submissionscomments
jez··on Unified Line and Paragraph Detection by Graph Convolutional Networks (2022)
Various apps already do this, if you find yourself reading lots of PDFs on phones. For example I use PDF Expert on iOS to do this. It’s not perfect—depending on the quality of the PDF there might be weird artifacts in the reflowed text (e.g., “ff” ligatures getting mapped to the Unicode ligature character “Latin Small Ligature Ff (U+FB00)” which breaks copy/paste/search).

But for PDFs which are really hard to read on a phone otherwise, it’s really a nice investment.

jez··on Why our website looks like an operating system
Very neat! I was delighted to see that "drag to side of screen" tiled the window using that half of the screen. Then I opened a new window, and I was (unreasonably) surprised to see that there wasn't a tiling window manager that put my second window in the other half of the screen.
jez··on Dropbox Paper mobile App Discontinuation
If you’re open to third-party sync clients, Maestral supports this:

https://maestral.app/docs/mignore

I’ve been loving Maestral so far, it’s just the syncing, none of the other stuff. It has some downsides (it can’t upload symlinks but it can download them, and it doesn’t have LAN sync) but it’s super lightweight.

jez··on How did a debate over housing become a call to end the anti-monopoly movement?
This response article makes the opposite claim, that it was Derek Thompson who played fast and loose with sources. As evidence, the Stoller piece cites testimonials from both Lance Lambert and Luis Quintero saying that in their interviews with Thompson, they never went on record as repudiating claims made on the BIG newsletter.
jez··on Maru OS – Use your phone as your PC
I could commute to the office every day with nothing but the shirt on my back and the phone in my pocket if my work-provided device were my phone. I would not need a backpack or briefcase, which means that for any errands or dinner plans after work, I don't fumble with a backpack. I already leave my preferred keyboard+mouse at my office desk.

If I needed to fly to another office for a business trip, same story: I could sit down at any desk, grab a spare bluetooth keyboard from IT (if there isn't already one on the bookable desk).

If I'm over at a friend's house for dinner and get paged, I could just ask to sit down at their desk and plug my phone in.

I would love to not have to carry a laptop around to all the places that I do today.

jez··on How I use my terminal
This is cool, I learned about `:cb` today (populate quickfix from current buffer)

I find that if I’m already piping into a buffer, I just leave it as a buffer. Vim’s gf and gf keybindings let me jump to the filename under the cursor, and it being a buffer makes it easier for me to edit (reorganize, group, further filter, etc).

I do think people undervalue the quickfix buffer though!

jez··on What Is the Difference Between a Block, a Proc, and a Lambda in Ruby? (2013)
I think this is the important point. Something I've mentioned about blocks in Ruby before: if you’re prototyping a new interpreted language and don’t want to have to build a JIT that can optimize code, but still want some semblance of good performance, the block approach Ruby picks can be pretty useful.

Ruby doesn’t haven to allocate a full-on, garbage-collected, closure object every time a function accepts a block: it only has to do this if the block gets stored to a variable. If the block is only ever yield’d to, the allocation can be skipped.

And when your language’s primary looping mechanism is done with blocks, the difference adds up:

    xs.each do |ys|
      # with normal closures and no fancy JIT,
      # the VM has to allocate a closure once per loop:
      ys.each do |y|
      end
    end
Ruby was able to get away with its closure-heavy standard library APIs without a JIT for almost 3 decades because of the affordances that blocks provide over procs/lambdas.
jez··on What Is the Difference Between a Block, a Proc, and a Lambda in Ruby? (2013)
Do you have a source for this?
jez··on Past, present, and future of Sorbet type syntax
I don’t know if there’s a Ruby reflection API to produce the values of default keyword arguments in a lambda, but correct me if that’s not the case. This syntax is neat enough to be worth spending some time thinking about if you can correct me.
jez··on Past, present, and future of Sorbet type syntax
We were in direct contact with the author, most bugs were reported over email. The project was a hobby project and we did not feel it to be prudent to flood someone’s hobby project with dozens of issues created by a team working at a venture funded startup.
jez··on Ty: A fast Python type checker and language server
Out of curiosity, do you have experience with other languages that have type system plugins that you’d hope be used as inspiration for something in Python?

I don’t have any such experience (short of a macro system, which requires code generation or runtime support) and it always makes me curious when people ask for type system plugins whether this is a standard feature in a type system I’ve never used.

jez··on I'd rather read the prompt
Where I especially hold this viewpoint is for end-of-year peer performance reviews.

People say “I saved so much time on perf this year with the aid of ChatGPT,” but ChatGPT doesn’t know anything about your working relationship with your coworker… everything interesting is contained in the prompt. If you’re brain dumping bullet points into an LLM prompt, just make those bullets your feedback and be done with it? Then it’ll be clear what the kernel of feedback is and what’s useless fluff.

jez··on Stop using e for compound interest
As with many "we should explain core math things better," there is a 3Blue1Brown explainer that attempts to give intuition for e:

https://www.3blue1brown.com/lessons/eulers-number

As suggested by the OP, it approaches the problem from the angle of showing that e^x is the only function that is its own derivative.

There is also a follow up explainer giving intuition for e^ix as being about modeling rotations.

https://www.3blue1brown.com/lessons/eulers-formula-dynamical...

jez··on macOS Tips and Tricks (2022)
Many of these features Windows has no analogue for. Consider:

> By default, clicking inside a scroll bar will scroll partially towards the clicked location. Hold Option while clicking in the scroll bar to jump directly to the clicked location.

There is no way to present this option in the GUI without cluttering up the scroll bar, so neither Windows nor macOS do so. But at least this feature is available for power users.

I admit that in places where there IS space in the UI (menu bar, right click), I find it odd that the option-variants are not listed unless option is actively being held.

jez··on Tufte CSS
I’m not sure what this URL is. The canonical source for the Tufte CSS project is hosted here:

https://edwardtufte.github.io/tufte-css/

jez··on Can you read this cursive handwriting? The National Archives wants your help
The handwriting in some of these snippets, while sometimes difficult to read for one reason or another, is nonetheless beautiful: did everyone who wrote have such great handwriting back then?

I'm looking at the piece in the Instagram post linked by the page, which begins, "honor of holding in their service". The lines are so straight, the letters are so uniform!

jez··on Show HN: I completed shipping my desktop app
It never occurred to me that ffmpeg’s license had these restrictions on use (I guess that should be obvious in retrospect, it’s LGPL licensed).

The ffmpeg docs have an straightforward list of things you have to do to link against ffmpeg and also be compliant with the license, which I found interesting:

https://ffmpeg.org/legal.html

jez··on Ghostty 1.0
Calling it libTerminal might be confusing. There are other terminal emulation libraries—for example libvterm[1], notably used to power the embedded terminal in Neovim.[2]

[1] https://www.leonerd.org.uk/code/libvterm/

[2] https://neovim.io/doc/user/terminal.html

jez··on Ask HN: Programmers who don't use autocomplete/LSP, how do you do it?
> What do you do if you need to look up the definition/implementation of some function which is in some other file?

Code search (ripgrep, GitHub search, Sourcegraph, git grep, or even just plain grep). You can use VS Code search but I prefer CLI tools so I can filter the output of my search with more searches—VS Code makes it hard to post-process/filter project-wide search results.

Filename search (fzf, fd, or just find).

There are cases where LSP-powered Go to Def is faster, but there are also cases where it’s less accurate. I’m talking:

- Untyped code in a graduate typed language

- References of a method name in a YAML file pulled out with reflection

- References of that method in a comment of some other method, where that method is actually the method I’m looking for.

- A one-to-one mapping of method names with some enum somewhere else, but lowercase in one spot, and all caps in the other spot.

So yes, sometimes go to def will be faster, but you’ll lose out on so many other possible references.

Another case: repos where the codebase is so large that the editor tooling is slow. Repos where I’m brand new to it, because I just need to check why some code in a third-party library is going haywire.

Grep (code search) is just so powerful.

I have a post about how to do large-scale code migrations/codemods. Everyone assumes the post is going to be about how to use high-powered, language-aware AST-based static analysis tooling. But half the post is talking about the unreasonable effectiveness of regular expressions.

jez··on The intricacies of implementing memoization in Ruby
In a similar line, it would be nice if there were a way to predeclare instance variables so that there was a canonical place to put type annotations for instance variables. Ruby type checkers right now all invent their own ways of declaring the types of instance variables.

If Ruby supported something like

    class A
      def @instance_variable
      def self.@singleton_class_instance_variable
      def @@class_variable
    end
as a way to pre-declare the object shape at class load time, it would be an obvious place to also let type checkers declare the types of these instance variables.

(Not saying that this specific syntax is ideal, but rather just that having some syntax for declaring instance variables at load time, not method run time, would solve both the "predetermined object shape" and "predetermined ivar types" problems.)

jez··on The intricacies of implementing memoization in Ruby
For those curious, this article is a good introduction to the topic:

https://railsatscale.com/2023-10-24-memoization-pattern-and-...

jez··on The intricacies of implementing memoization in Ruby
The Python version and this Ruby version are not equivalent.

In Ruby, default parameters are allocated for each call to the function, which means that they are not shared across calls.

In Python, default parameters are allocated once and shared across all calls, allowing them to be mutated.

This becomes obvious if we change the Python and Ruby versions to print when they're computing something that is not yet cached. For back-to-back calls to `fib(10)`, the Python version prints only on the first call to `fib(10)`. The Ruby version must recompute all values from 2 – 10 again.

jez··on How can you represent inheritance in a database? (2010)
I recently read a lot about solutions people have come up with to put a class hierarchy into a relational DB, because it all mostly applies when the domain’s data model makes heavy use of ad hoc union union types (like TypeScript’s union types).

If you only skimmed the StackOverflow post or were about to bounce because “my models don’t form complex inheritance hierarchies,” ask whether you’ve tried to serialize something with type `A | B` to the database and been frustrated at there being no good solution. Then (re-)read the post in that framing and see if the solutions proposed and tradeoffs discussed look more relevant to you.

It’s made me realize that there’s probably a lot more collected wisdom locked up in writings from the 90’s and early 00’s that I disregard because it’s so heavily class inheritance focused. Alternatively: free blog post ideas by re-contextualizing this content in contemporary languages and technologies!

jez··on MarkItDown: Python tool for converting files and office documents to Markdown
The README of MarkItDown mentions "indexing and text analysis" as the two motivating features, whereas Pandoc is more interested in document preparation via conversion that maintains rich text formatting.

Since my personal use leans towards the latter, I'm hesitant to believe that this tool will work better for me but others may have other priorities.

jez··on "Rules" that terminal programs follow
Some more notes:

- If this is your first time hearing about the readline/emacs keybindings like Ctrl-E and Ctrl-W, you'll be pleased to know that most macOS input sources use these keybindings. If you're on macOS, feel free to try Ctrl-E, Ctrl-W, or Ctrl-U in your browser's address bar right now

- If you're using a command line program that doesn't support _any_ line editing (e.g. no readline keybindings, and no other keybindings), you can install the `rlwrap` program and launch the REPL under rlwrap. For example Standard ML of New Jersey has a REPL but no line editing functionality, but you can recover that via `rlwrap smlnj`

- "don’t use more than 16 colours" — I would go so far as to say "don't use more than 8 colors, or at least make your colors configurable." Many popular color schemes, including Solaraized and the default Base 16 color scheme, use the "bright" colors to hold various shades of gray. What you think is "bright green" might actually be the same shade of gray that normal text is colored.

jez··on Hey, wait – is employee performance Gaussian distributed?
Also: the specific choice of the year 1971 (as opposed to say "the 70s" or "the late 60s") is usually meant to call attention to the fact that in 1971 the US abandoned the gold standard for the US dollar.

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

jez··on Concerns raised over Bitwarden moving further away from open source
My reading from the License section[1] of the Keepasium README and this Stack Exchange post[2] is that the author of KeePassium wishes to license KeePassium under GPLv3. Accepting applications licensed under GPLv3 would require that Apple provide certain forms of source code alongside App Store downloads which they are unwilling to do. As such the App Store terms of service has terminology stating that you give Apple the right to not do that, which is something that only the copyright holder(s) of a work can do. The simplest way to have clarity over who holds the copyright is to have a single author. So long as the KeePassium author is willing to assign Apple the permission implicit in submitting to the App Store, that’s fine. It just means that all other uses of KeePassium must follow the GPLv3 license.

I am not a lawyer, nor really even well-versed in IP law, and you should not take this as legal advice.

[1] https://github.com/keepassium/KeePassium?tab=readme-ov-file#...

[2] https://opensource.stackexchange.com/questions/9500/is-apple...

jez··on Concerns raised over Bitwarden moving further away from open source
Yes, via the KeePassium client:

https://github.com/keepassium/KeePassium

As with all iOS apps, there’s no guarantee that the open source app code on GitHub corresponds to what you install from the App Store.

I have been very satisfied with KeePassium, it integrates with all the cloud storage providers I’d want and the app itself works well.

jez··on Caltrain's new electric trains
The one electric Caltrain I rode recently played an ear shattering tone inside the trains when the doors were about to open and close. With any luck and enough complaints, it should be easy enough to dial that back or drop it entirely. I don’t remember the old trains ever playing a noise as loud when the doors open and close.
jez··on Bug squash: An underrated interview question
Sorry about that! edited to

> What we're observing is X, but we want to see Y instead.

← PreviousPage 2 of 10Next →