HNHacker News
TopNewBestAskShowJobs

rav

1,266 karma · joined February 20, 2013

[ my public key: https://keybase.io/ravv; my proof: https://keybase.io/ravv/sigs/iqfti_2jqJcDaAHMPVlrVndLEH7npqbzA7qHMvhSCmY ]
submissionscomments
rav··on A More Modern CSS Reset (2019)
I don't think CSS resets make developing CSS easier for me... I'd rather have one set of bad defaults to develop on top of, than each project starting with its own set of good defaults that I then have to understand the strengths/weaknesses of every time.

Stuff affected by CSS resets rarely comes up when I'm sticking to the standard set of UI components for the project, and when it does, I need to do just as much debugging with the CSS reset as I would have to do without a reset.

rav··on Gnome Files: A detailed UI examination
Can't you use ctrl-left click to deselect the selected file before using ctrl-right click to get the context menu?
rav··on PC Floppy Copy Protection: Softguard Superlok
I thought this was going to be about the physical notch switch on some floppies to switch them between read-write and read-only modes... That thought alone brought back some deep childhood memories!
rav··on SVG Triangle of Compromise
According to a forum post [1], e.g. iPad Mini 4 was discontinued March 2019 and is stuck on iOS 15, which doesn't support nested styles. Perhaps the issue is that people want to continue using old tablet devices that are no longer getting OS updates?

[1] https://education.apple.com/resource/250012027

rav··on You'll regret using natural keys
Instead of a random string ID, you can devise a fixed secret key and expose the auto-incremented ID xor the fixed secret key as the public-facing ID. This saves you the separate index but still avoids the German tank problem. But it gives you a new problem, namely a secret that's hard or impossible to rotate.
rav··on FILE_ID.DIZ Description (1994)
Perhaps the eminently useful <PLAINTEXT> tag hadn't been invented in 1994 :-)
rav··on To the brain, reading computer code is not the same as reading language (2020)
Both programs and math proofs are allowed to be written in story mode where definitions can come after their usages. Unless you write in C. There's no story mode in C :-)
rav··on Show HN: Geometry-aware Hashing of GeoJSON objects
> After thinking far too long about how I can sort coordinates reliability, I chose the easy way out:

In addition to the code, please also give a plain language description: "We ensure that the first coordinate is the lexicographically smallest (i.e. most westward point). For line strings, reverse the coordinate list to make it so, and for polygons, rotate the coordinates to make it so."

> val reordered = coordinates.subList(index, coordinates.size - 1) + coordinates.subList(0, index)

This should say + coordinates.subList(0, index + 1), and then you can get rid of the code that checks for first != last.

rav··on Google Meet rolls out multi-device adaptive audio merging
You can use it with just a personal Google account - does that require a phone number? Alternatively, someone with a Google account can create a meeting (https://meet.new) and send you the link, which you can join without any Google account at all.
rav··on Google Meet rolls out multi-device adaptive audio merging
Meet is nice and nicer than Teams and Zoom in my opinion, but for 1-on-1 pair programming I think Facebook Messenger actually has the best experience - when you're on the same screen resolution, the screen sharing is 100% zoom (unlike Meet which has padding around the edges), and you can move seamlessly between mobile and desktop (i.e. answer a video call on mobile, the other party sets up screen sharing, and you go to a laptop to continue the call). Too bad I'm not automatically Facebook friends with all my co-workers!
rav··on North Yorkshire Council to phase out apostrophe use on street signs
The Danish Address Register (DAR) assigns a UUID to everything in the addressing system - street names, postal codes, building addresses... It's a nice official database to have in Denmark but I don't know of any products that actually store the UUIDs in the database.
rav··on A Single Div
Looking at the CSS for a few of the pictures, it seems like it's more CSS backgrounds specified using lots of gradients. I wonder if it would be faster to implement an SVG-to-CSS-gradient compiler or implement the pictures directly using CSS gradients.
rav··on Oh My Git: An open source game about learning Git
After typing "git init" in the terminal in the level called "The command line", I then wanted to try my luck so I typed "vim". Now the terminal is stuck. How do I exit vim?
rav··on WinBtrfs – an open-source btrfs driver for Windows
> That said, a lot of what’s actually hard about IO is the error/fault handling, imposing timeouts and backoffs and all that jazz.

Application-level timeout/backoff handling is always scary to me, because I don't know how to make robust tests for it. I wonder if you couldn't use the same I/O-less approach, and split the logic out into pure functions that take the time passed/error state/... as value arguments, instead of measuring the physical time using OS APIs. It's probably not something for reusable libraries, but it could still be a nice benefit to be able to unit test in detail.

rav··on Google Blog on DMA
The stuff about flights is not clear to me. Is this about flights results in Google Search, or is it also about searching on Google Flights i.e. https://www.google.com/travel/flights - I use Google Flights in Europe a lot and I haven't noticed any decline.
rav··on The xz sshd backdoor rabbithole goes quite a bit deeper
> The backdoor relies on sshd being patched to depend on libsystemd to call sd_notify

I remember when we added sd_notify support to our services at work, I was wondering why one would pull in libsystemd as a dependency for this. I mean, there's a pure-Python library [1] that basically boils down to:

  import os, socket
  
  def notify(state=b"READY=1"):
    sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
    addr = os.getenv('NOTIFY_SOCKET')
    if addr[0] == '@':
     addr = '\0' + addr[1:]
    sock.connect(addr)
    sock.sendall(state)
With proper error handling, that's about 50 lines of C code. I would vendor that into my application in a heartbeat.

[1]: https://raw.githubusercontent.com/bb4242/sdnotify/master/sdn...

rav··on IrfanView
I downloaded IrfanView and ran "strings" on the exe file, and one of the strings in there is "Microsoft Visual C++ Runtime Library" - so that would point towards C++ (although it's not certain from that alone).
rav··on My favourite animation trick: exponential smoothing (2023)
Ah, I think I considered the article to be a supposed improvement to CSS animations - in which case both exponential smoothing and px/s transitions would be independent improvements.
rav··on My favourite animation trick: exponential smoothing (2023)
But can't you then also change the units on the linear animations? "move 40px/s until you reach the destination"
rav··on My favourite animation trick: exponential smoothing (2023)
> If you've used CSS transitions you'll have encountered the problem this solves. Okay, my duration is 400ms -- but why 400? Shouldn't it depend on how far it has to move?

It seems to me that the "speed" parameter in the exponential function has the same issue, does it not?

rav··on The Ipe extensible drawing editor
It's a quite distinct GUI - there's not really any screenshots in the official materials, but if you do a Google image search for "ipe" "latex" then you can see what it looks like.
rav··on The Ipe extensible drawing editor
Ipe is a nice power tool - I learned to use it in grad school and have used it to draw technical illustrations that are essentially polished sketches. For example Figures 1 through 8 in this paper: https://users.cs.duke.edu/~pankaj/publications/papers/flood-...

Other people like TikZ, but the kinds of illustrations I gravitate towards rarely have a neat exact compass and straightedge feel that lends itself to coding in TikZ (e.g. Figure 4). Then for certain figures I have used Ipe as an intermediate language similar to SVG, where I would write a Python program to produce some precise drawing that I could then tweak by hand in the Ipe GUI (e.g. Figure 2).

rav··on SymPy: Symbolic Mathematics in Python
There `isympy -I`, which runs an IPython REPL with a preprocessor that changes unknown variables into sympy symbols, but that only helps you for interactive usage.
rav··on A random dungeon generator that fits on a business card (2019)
> there's obviously no guarantees of solvability

In fact, as the size of the maze goes to infinity, the probability of solvability goes to zero. Source: https://cstheory.stackexchange.com/a/32381/20581

rav··on Dynamic programming is not black magic
> You come up with some topological order of states in abstract state-space

If the state space is "subsets of V", then it's exponentially larger than the set of states actually visited in Dijkstra's algorithm. Dijkstra's algorithm has an invariant that the vertices visited have a smaller distance than the vertices not visited. For vertex sets that adhere to this invariant, there's clearly a topological order, but for arbitrary subsets of V I don't see how this topological order would be defined.

I guess my gripe is that in my view, the framework of dynamic programming is not a useful way to analyze algorithms that explore a small set of states in an exponentially larger state space.

rav··on Dynamic programming is not black magic
In dynamic programming, the problem can be solved by solving subproblems, and those subproblems are solved by solving subsubproblems, and there is overlap between these subproblems. This allows us to solve DP problems in two ways, either by recursion with memoization or by iterative table filling.

Although the shortest path problem has some kind of "optimal substructure", the recursive memoized approach doesn't work because there's no set order in which the subproblems can be solved. Instead, you need to compute the shortest paths in order of shortest path length, and the shortest path lengths aren't given ahead of time - those are exactly what Dijkstra's algorithm computes!

It's not enough to call it dynamic programming that "the shortest path must be the shortest path through one of its neighbors", because this fact doesn't immediately lead to an acyclic subproblem dependency graph.

Shortest path on an acyclic graph, and longest path on an acyclic graph, are two problems that can be solved with dynamic programming - but Dijkstra's algorithms solves shortest paths on a different class of graphs that doesn't lend itself to DP.

rav··on Dynamic programming is not black magic
> And many common algorithms are actually just the application of dynamic programming to specific problems, including omnipresent path-finding algorithms such as Dijkstra’s algorithm.

Dijkstra's algorithm is an application of dynamic programming? I disagree. In dynamic programming, you tabulate the subproblems to solve, with static interdependencies between them leading to straightforward orders in which to solve the subproblems. In Dijkstra's algorithm, you need to compute the shortest path from s to each vertex, but the order in which you have to visit the vertices is only discovered along the way using a priority queue, so the subproblem interdependencies are not known ahead of time until you have actually solved the problem.

rav··on Show HN: Better Seater – Wedding seating chart optimizer
Ah cool, somehow I didn't notice that! I've made an anonymized version of my guest list to try it out. Another thing that I noticed is that I put notes with some of my guests, and also some couples are in two groups - does your app work with multiple groups, or does that not make sense with the optimization?
rav··on Show HN: Better Seater – Wedding seating chart optimizer
Requirements for the Seating Chart Optimizer I made for planning my wedding party:

* 120 guests: 49 couples and 22 singles

* To be seated at 11-ish tables of 8, 10, 12 people each (by combining 4- and 6-person tables)

* Couples must be seated at the same table

* Plan only needs to say which guests sit at which tables - individual placement at the table will be decided just-in-time by the people putting the name cards down on the day

* It's hard for me to give labels to the guests to give you an idea of who can form a nice table and who can't. It's like, complicated, but I know a good table when I see one.

I made a spreadsheet-based app [1] where I first entered couples and singles into rows and then left blank rows as table separators. On the blank rows I put a "table capacity" number (8, 10 or 12), and on the guest rows I put a formula to compute "remaining table capacity", using conditional formatting to highlight tables where there are too many guests and tables where there are still seats available. By dragging rows around I can quickly rearrange the plan, and the spreadsheet doesn't do much except tell me where the plan is currently "broken" due to overfull tables.

If I compare my requirements with the Better Seater interface, what I'm missing is a way to keep couples together always - I don't want to make a new "group" name for each couple and I don't want to drag twice to move a couple. I haven't tried it with 120 guests, but I'm curious what sort of guestlist size you're aiming for.

[1] https://docs.google.com/spreadsheets/d/1ciib95VBI1YE9KFfPZAp...

rav··on Reminiscing CGI Scripts
> can have shared state for database connections but the main interpreter is not a separate process but simply a function call.

> It would have to be multithreaded, it could communicate with nginx via domain socket as php-fpm does.

If we define the communication with nginx over domain socket to be HTTP/1.1, then you have basically reinvented Rails / Flask / Django / Hyper / ... - you can define each script as a Python/Ruby/Rust function and everything runs in shared processes so you can cache database connections and other things if you fancy.

← PreviousPage 2 of 10Next →