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.
1,266 karma · joined February 20, 2013
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.
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.
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.
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...
It seems to me that the "speed" parameter in the exponential function has the same issue, does it not?
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).
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
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.
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.
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.
* 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...
> 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.