HNHacker News
TopNewBestAskShowJobs

bhl

1,498 karma · joined February 19, 2017

thinking about the world through unrealistic models · interested in the intersection of tech and everything else

https://github.com/BrianHung cv.brianhung.me

submissionscomments
bhl··on Improvements to data analysis in ChatGPT
For a generative and collaborative web app, you would have to hook up those declarative components to function calls which are also declaratively written and perhaps use OT/CRDTs to mutate state.
bhl··on Improvements to data analysis in ChatGPT
To collaborate with LLMs with text editors and spreadsheets, yeah I do think we will need deterministic declarative primitives that both users and LLMs can use. Getting those primitives right would also get us generalized autocomplete for apps.
bhl··on Quill v2 – Rich text editor
Nothing is built into ProseMirror except for the text span.

For a definition list, you’d probably want two node types: a definition list, and a definition list item.

And then create toDOM and parseDOM methods to render and parse respectively the html you want.

bhl··on Apple Ordered to Pull WhatsApp/Threads from China App Store
Instagram and TikTok don’t work in China without a VPN. I’d be surprised if other Meta apps worked either. Most apps in China require a Chinese phone number to fully work too.
bhl··on Array languages vs. the curse of the spreadsheet
Yeah, 'spilled array' and 'spilling' are the correct noun and verb.

https://support.microsoft.com/en-us/office/dynamic-array-for...

bhl··on Tell HN: UC Berkeley's CS61A/B/C are the best courses to learn CS and coding
> CS61A was awful for me and made me hate computer science.

Valid criticism. Think for most students, 61A has too steep of a learning curve for an introductory class. For people without any programming experience, it’s a bit too much too fast and with a class size of 2000+, you struggle for resources.

For those with prior experience, it feels like unnecessary training wheels. You learn a little bit of Python, SQL, and Scheme. You have to do environment diagrams (What Would Python Do) on paper, and learn how to use a debugger. Projects and tests have mad-libs style fill in the skeleton code.

In my experience, 61A is a tasting menu of computer science: you take it for the experience, and leave hungry and confused – but excited.

> I tested out of 61B.

OP, you really missed a lot by testing out. This class is half theory, half learn by doing. For example, you learn about red-black trees or Dijkstra's in lecture and then go to lab and implement it.

I know theory and algorithms seem bland at first, but look at the applications. https://www.cs.princeton.edu/~wayne/kleinberg-tardos/

Favorite aspect of this class was designing and then writing a smaller version of git. You had to write a design spec that was checked off, and then your implementation had to pass a test suite.

If that’s not software development, then I don’t know what it is.

> 61C taught me how computers actually work and simultaneously made me quit the major.

61C was not one of my favorite classes because of how low level it is (compilers, RISC-V, concurrency, etc.). But if you stopped taking classes before upper division, you missed out on a whole gamut of “practical” classes like algorithms (CS170) and operating systems (CS162).

bhl··on Historic algorithms help unlock shortest-path problem breakthrough
Yes, if trading BCA results in a profit, either BC or CA has negative weight. Negative weight here just means you can sell a currency more than its cost basis, and or buy a currency for cheaper than its cost basis.

Though with arbitrage, you typically want to find a cycle like BCAB so you have more of the initial currency you started off with.

bhl··on Historic algorithms help unlock shortest-path problem breakthrough
Yep! Executing arbitrage is definitely harder than finding they exist though.
bhl··on Historic algorithms help unlock shortest-path problem breakthrough
> In finance, for example, there may be situations in currency or options trading where buying and selling in one sequence is more profitable than taking a different path, and these can be modeled using negative weights as long as the search algorithm is fast enough.

This is a non-contrived example. You could do this as a mini-project where you scrape various foreign exchange or cryptocurrency data, and try to find some arbitrage opportunities by running these shortest path algorithms.

bhl··on Historic algorithms help unlock shortest-path problem breakthrough
The issue with negative weighted edges is that a cycle would result in an infinite loop when finding shortest path, compared to when all edges are non-negative, cycles can be safely skipped.

Compared to Dijkstra's original algorithm of E + V log V, naively pre-processing edges would require V^2 work assuming an edge can exist between each vertex.

Edit: the algorithm you’re describing exists btw https://en.m.wikipedia.org/wiki/Johnson%27s_algorithm

bhl··on Launch HN: Tiptap (YC S23) – Toolkit for developing collaborative editors
I've found react-prosemirror [1] to be a light ProseMirror React integration that supports node views. I had also considered Remirror before, but its abstraction and internals seem even heavier than Tiptap's.

[1] https://github.com/nytimes/react-prosemirror

bhl··on Launch HN: Tiptap (YC S23) – Toolkit for developing collaborative editors
> With ProseMirror, I’d need to tunnel through 1 layer of abstraction and/or patch 1 layer of abstraction. With Tiptap, maybe I’d need to fork-and-patch both you and ProseMirror? Each layer also increases our maintenance liability.

As a contributor to the previous version of Tiptap, and as a developer that built extensions into it, I encountered the exact same problem of having to learn two different APIs while trying to build more advanced features.

Out-of-the-box libraries like Tiptap are great when their extensions or components fully cover your use case. But when you need to customize or own the code itself, the secondary abstraction becomes leaky and you start to fight against it.

Because I was building a note-taking app, I spent most of the time working on the rich text editor. Eventually, I just ripped the bandaid off and wrote a new library that was architected off Tiptap but was a thinner abstraction on top of ProseMirror.

With hindsight, I can definitively say that was the better personal choice. The last time I used Tiptap was in 2020, and since then its API has evolved to a point where my knowledge is way outdated. On the flip side, ProseMirror has been extremely stable, improving with a non-breaking typescript rewrite. Digging into the internals of ProseMirror, learning how it has been built and maintained, contributed massively to how I write code today.

That being said, the journey of moving off Tiptap to ProseMirror took a couple of months for a junior dev. So I can understand how a market for it exists. My only wish for Tiptap now is for it to reduce its API overhead on ProseMirror, and instead build more advanced ProseMirror-compatible plugins that require a backend. Collaborative editing (comments, annotations), version control and schema migration, etc are all exercises normally left up to the developer that can be solved by Tiptap well.

bhl··on Launch HN: Tiptap (YC S23) – Toolkit for developing collaborative editors
Have you tried the nytimes react integration? https://github.com/nytimes/react-prosemirror

It should be lighter than tiptap.

bhl··on Show HN: I made an open-source Notion-style WYSYWIG editor
For rich text, I would just use ProseMirror or Lexical and avoid the pain of working with contenteditable directly.

To appreciate the difficulty and nuances with building a text editor on contenteditable, I would read through the commit history on ProseMirror https://github.com/ProseMirror/prosemirror-view/commits/mast...

bhl··on I lived in LA and commuted to Berkeley by plane to save on rent
My takeaway from reading about the person's experience is that we need better high speed public transportation in California. It would unlock a lot of economic and non-economic opportunities if people can move across the state within an hour. Imagine if Berkeley was a commuter school for people in Los Angeles, or UCLA was a commuter school for people in Bay Area.
bhl··on Google “We have no moat, and neither does OpenAI”
> It's going to be seamlessly integrated into every-day software. In Office/Google docs, at the operating system level (Android), in your graphics editor (Adobe), on major web platforms: search, image search, Youtube, the like

Agreed but I don’t think the products that’ll gain market share from this wave of AI will be legacy web 2 apps; rather it’ll be AI-native or first apps that are build from ground up to collect user data and fulfill user intent. Prime example is TikTok.

bhl··on Observable Plot: A JavaScript library for exploratory data visualization
Need a chart library that is easily configurable by an end-user using a GUI. Think they have their data in a spreadsheet and want different types of charts and ability to pick things like color or labels. Does this work? I’ve been looking at recharts or ant-charts recently.
bhl··on Will boiling water ruin green tea?
For all lazy matcha makers, I’d recommend getting a milk frother: it heats up water and also mixes matcha powder. For those who like matcha lattes, I think it’s even more essential as frothing milk makes it more sweet and fluffy.
bhl··on Ask HN: What is your favorite front end state management solution?
mobx-state-tree (https://mobx-state-tree.js.org/)

Benefits of it over mobx is data normalization with references and JSON patches which allow you sync complex state easily. Typed models are also a plus.

Drawbacks are performance (see https://github.com/mobxjs/mobx-state-tree/issues/1267).

Previously was using immer, which I loved because of immutability but moved off since classes and OOP didn't feel as natural as in mst.

If I were to pick an alternative, might try redux with normalization https://redux.js.org/usage/structuring-reducers/normalizing-....

And if I were to build a state management tool, I would prioritize a library that has - immutability - JSON patches and snapshots - data normalization with references - schemas / models compatible with zod

bhl··on CRDT: Fractional Indexing
Is there a good resource on designing collaborative apps with CRDTS, that is which type of CRDT and conflict resolution to pick for a given application? Something like https://mattweidner.com/2022/02/10/collaborative-data-design... but generalizes.
bhl··on Show HN: uFuzzy.js – A tiny, efficient fuzzy search that doesn't suck
> best-in-class memory overhead

Was using indexeddb considered? I've yet to see an easy to use library that allows you to store simple but large json in indexeddb, and then query against that. Useful for something as simple as an emoji picker which needs to store keywords or aliases.

bhl··on Workerd: Open-source Cloudflare workers runtime
Is there an ETA on Miniflare v3? Ran into a problem recently using overlapping keys with forward slashes as they were not sanitized properly: https://github.com/cloudflare/miniflare/issues/167
bhl··on Ask HN: What are some cool but obscure data structures you know about?
Does immer have the same drawbacks as immutable? It uses proxies as opposed to hased array map tries.
bhl··on Vectorized and performance-portable Quicksort
Regarding columnar databases, is there an optimal data structure in between storing data as rows and storing data as columns that would make it fast to sort and filter by either dimension? Some mix of B-trees or interval trees?
bhl··on Facebook open sources Lexical, an extensible text editor library
Maybe worth merging threads since they're about the same event and that post has some comments by a maintainer.
bhl··on Lexical is now open-source (web text-editor)
Could you elaborate on what you mean by "source-of-truth that wasn't the DOM" and "performance and accessibility"?

Having read through Lexical's documentation and worked with ProseMirror before, the approach by Lexical feels similar to ProseMirror's except written from a React + Hooks perspective.

bhl··on Peritext: A CRDT for Rich-Text Collaboration
Are there plans to make Peritext production-ready like Yjs, or is this more of a sketch for people to build their own collaborative rich text editor integrations?
bhl··on Goodbye CSS Modules, Hello TailwindCSS
I've used it with other tools / frameworks like Vite or Svelte; it's pretty agnostic. Plus setting it up is a one time thing.
bhl··on Spaces launch in Element
So sort of a user interface like TweetDeck where you can horizontally scroll between multiple feeds?
bhl··on While posting to Tumblr, E and W keys just stopped working
To be fair to authors of those third-party libraries, some of the blame has to do with browser quirks, and for a rich text editor, bugs in the implementation of content-editable that have to be normalized across all browsers (unless you pull the engineering-heavy route of rewriting everything in canvas).
← PreviousPage 3 of 13Next →