Better HN
topnewbestaskshowjobs
Log inSign up

hddqsb

421 karma · joined Sep 6, 2017 (9y ago) · 235 submissions

Submissions

comment 2y ago · link · parent

I thought this was going to be about Android (which makes heavy use of that term), and I was expecting completely different complaints:

- The toast disappears quickly, so you might not have time to read it / take a screenshot

- It's not possible to copy the text

- Long text is truncated (e.g. exception messages)

comment 2y ago · link · parent

There is a serious bug in Wolfram Alpha's "math input" mode. When you enter e²ⁿ, it is interpreted as e²n (full details at the end). This was reported to them a month ago and still hasn't been fixed, so I figured it was time for some public shaming ;)

I've been really impressed with Wolfram Alpha over the years (both the natural language parsing and the power of Mathematica); my main issue until now has been that the natural language parser tends fail on inputs beyond some length (fortunately Mathematica syntax is also supported and works well). So I was very surprised when this glaring bug in math input mode was shared with me.

Full steps to reproduce:

1. Go to https://www.wolframalpha.com/

2. Click "MATH INPUT"

3. Click the "power" button (second from the right, icon is two boxes with one in superscript)

4. Type "e" (it should go in the first box)

5. Click the superscript box

6. Type "2n"

7. Click the "=" button

Result: The input field correctly shows e²ⁿ (with the "n" in superscript), but the formula shown in the "Input" section is e²n (the "n" is outside the exponent) and the "Plot" section shows a straight line which confirms that the input was misinterpreted as e² * n.

Explicitly adding parentheses around the "2n" fixes this. Ironically, when you do that the "Input" section shows the formula as e²ⁿ (without the parentheses; the same version that fails when entered in the input field).

3.

Wolfram Alpha's math input is broken(wolframalpha.com ↗)

4 points · by hddqsb · 2y ago · 2 comments

comment 2y ago · link · parent

Docker & co. also let you create a clean build environment (to a lesser extent), and I find them less intrusive than Nix / Guix.

comment 2y ago · link · parent

Fix:

  ps() { for i in /proc/[0-9]*; do readarray -d '' -t cmdline < "$i/cmdline"; printf "%s: %s\n" "${i#/proc/}" "${cmdline[*]}"; done; }

comment 2y ago · link · parent

A little late to the party...

> The slow cases usually tend to be trying to find wider slots and skipping through many smaller slots. There are often a lot of bookings up to the first wide enough slot too though, so it's a little bit of both.

This right here is the first critical issue. It doesn't matter how fast the data structure is if you're then going to do a linear search over the available slots to find the next one wide enough.

A good data structure for doing this efficiently is a range tree (https://en.wikipedia.org/wiki/Range_tree), where in each node you store the maximum width of the available slots covered by the node. That lets you find the first available slot after some time t and wider than some duration w in O(log(n)), where n is the number of available slots. (It might not be obvious if you're not familiar with range trees; I'm happy to provide more details.)

For the implementation, there are a few options:

A. The simplest is to use a complete range tree, where the leaf nodes are all the possible times. You can lazily create nodes to avoid massive memory usage for sparse ranges. The advantage is that you don't need to do any balancing; the disadvantage is that the time complexity is O(long(T)) where T is the total number of possible times; so it's going to be a little slower on very sparse datasets.

B. The O(log(n)) implementation that's being called for is a self-balancing binary tree (e.g. red-black), modified to also store the maximums in each node. Unfortunately most libraries don't give you low-level control over the tree's nodes, so you'd likely need to copy the code and modify it (or implement the self-balancing tree from scratch).

C. If those are still too slow (and you're certain that your implementation is really O(log(n))), you'll need to improve the cache efficiency. That basically comes down to using larger nodes. The obvious approach is to switch to a B-tree; but you could also keep your nodes binary and just change the way they are allocated to emulate the memory layout of a B-tree (this is simpler but slower because it still uses lots of pointers). Another idea is to replace the first few layers of the tree with a hash table (or a simple array if your data is dense enough). Likewise you can replace the leaf nodes with small arrays.

comment 2y ago · link · parent

The article's actual title is "High Court orders temporary suspension of Telegram's services in Spain", not "Spanish High Court banned Telegram".

This is a temporary suspension while investigating "after media companies complained it was allowing users to upload their content without permission".

comment 2y ago · link · parent

Great sleuthing, the missing piece of the puzzle is that the file contents are inside a <code> element while the line numbers are not, and <code> elements have a default font so they don't inherit the font from their parent element. Changing the selector to the following fixes the issue:

  div#cgit pre, div#cgit code { ... }
(The buggy CSS is not present in the the official cgit repository, so I assume the owner of kernel.dk is running a patched version of cgit.)

comment 2y ago · link · parent

There is now an open issue: https://github.com/francoismichel/ssh3/issues/79

comment 2y ago · link · parent

In fact the article mentions a tool for this (sslh), but rejects it because it hides the source IP from the HTTP backend (and other reasons).

comment 2y ago · link · parent

In the case of SSH, there is a single connection (in fact SSH implements its own multiplexing), so I don't see the advantage of HTTP/2.

comment 2y ago · link · parent

I agree. Stack Exchange's Code Golf has public source, but the best there is 644 bytes: https://codegolf.stackexchange.com/a/4198

comment 2y ago · link · parent

Yes, that's likely to work on many firewalls, but:

- it means you can't also serve HTTP on those ports (so you'd need a dedicated IP address for SSH), and

- as @charcircuit wrote, it won't resist deep packet inspection.

(But if DPI is a problem and you have a spare IP address, you could just use SSH over TLS without needing the HTTP CONNECT stuff and Apache.)

comment 3y ago · link · parent

This article is not about graphics drivers. The project in question is "advanced parking and driving assistance technology".

comment 3y ago · link · parent

Tip: If pull up/down feel backward to you when the plane is flipped, go into the options and enable "Harry keys mode" :)

comment 3y ago · link · parent

Yep. The relevant parts from the article:

> ... I run a simple scan ... against all the 74 real looking GitHub user tokens ... and discovered that 6 of them are actually valid.

> ... only 2 of them actually have bio and email, but one of them (a c/c++ developer) has a repo with 3.4k stars ...

> I obviously couldn’t verify all the secrets. From most of them I’ll probably be banned, so I stooped here.

As an alternative to manually testing the credentials (and risking bans), I wonder if any organisations would agree to test the credentials for you if you sent them a list of suspected leaks. If the organisation doesn't tell you which ones were valid (and takes responsibility for revoking/notifying), I don't see much room for abuse. Might be hard to convince the organisation of that though!

comment 3y ago · link · parent

A clever person got that account banned. When you try logging in with that email and a random password, it will fail, and Windows will allow you create a local account. (ref: https://news.ycombinator.com/item?id=37179504, https://news.ycombinator.com/item?id=33049235).

comment 3y ago · link · parent

It is perfectly reasonable and consistent for one thread to set an environment variable while other threads are reading different environment variables.

comment 3y ago · link · parent

Sure, some applications might require custom higher-level synchronisation, but it's still important for getenv/setenv to be thread-safe (i.e. not crash):

- The race might be irrelevant (e.g. simultaneous calls that access different variables are fine).

- The application author might not have complete control over all calls to getenv/setenv (e.g. if using a third-party library).

comment 3y ago · link · parent

In Chrome you can inspect your closure (as you clarified in https://news.ycombinator.com/item?id=38226743#38231705) using the "Watch" pane, and then look at its "[[Scopes]]" pseudo-property. I don't think there is a way in Firefox.

comment 3y ago · link · parent

> printf can also replace a lot of uses of the "date" command

Very cool (but bash-specific). Manual: https://www.gnu.org/software/bash/manual/bash.html#index-pri...

> sh /bin/echo -n "test"

This is gibberish -- it's trying to execute /bin/echo as if it was a shell script. Maybe you meant:

  sh -c '/bin/echo -n "test"'

comment 3y ago · link · parent

EDIT:

- They do have several non-spherical moons and asteroids (bottom left), which is awesome. I tried finding a 3D model of Charon online; NASA's model (https://science.nasa.gov/resource/charon-3d-model/) is disappointingly spherical, on the other hand https://3d-asteroids.space/moons/P1-Charon has a satisfyingly bumpy surface (for half of Charon).

- Fixing the zoom direction is almost within reach -- there is an option "Mouse Rate: In/Out" which defaults to 1 and can be used to slow down / speed up zooming, unfortunately it won't let me set it to a negative value to flip the direction.

comment 3y ago · link · parent

Very cool. Some small criticism/feedback:

- Pluto is shown as if it is spinning around itself, but in reality Charon (its largest moon) is so heavy (12.2% of Pluto) that their barycentre (https://en.wikipedia.org/wiki/Barycenter_(astronomy)) is actually outside of Pluto's surface.

- All the planets and moons are shown as perfectly spherical, but for the smaller ones (e.g. Charon) that's not accurate. Not sure if there is a practical way to fix this though.

- Zooming using the scrollwheel is backwards -- rolling the scroll wheel up zooms out, but in all other applications on my system it zooms in.

- The panels are very annoying. They can be hidden by unticking in the top right corner, but they still come back on mouseover (getting in the way when trying to click on a planet). I can't find a way to completely close them; they can be moved around, but they refuse to go offscreen. "Options > GUI Size> Small" helps a little.

comment 3y ago · link · parent

It's not a big deal because there is no need to retry 20 times. The probability of getting a deleted article several times in a row is very low, so you could limit to e.g. 5 tries, and if all are deleted fall back to the next non-deleted article (or even a hard-coded article). The bias would be negligible assuming the proportion of deleted articles is low; to guarantee that it is low, one can periodically renumber to eliminated deleted articles (this can be done efficiently using the trick suggested by @munificent; but the naive O(n) approach would probably be good enough).

comment 3y ago · link · parent

For the curious: They make getenv() thread-safe by intentionally leaking the old environment, which they argue is acceptable because the memory leak is bounded to 3x the space actually needed.

The getenv/setenv/putenv/environ API looks terrible on closer inspection -- it does not appear possible for an implementation to be safe, leak-free, and efficient.

comment 3y ago · link · parent

Good point about `putenv()`; however there is also `setenv()`, which does make a copy, so you are wrong about `getenv()` in general.

POSIX explicitly states "The string [returned by getenv] may be overwritten by a subsequent call to getenv(), setenv(), unsetenv(), or putenv()" (https://pubs.opengroup.org/onlinepubs/9699919799.2008edition...).

comment 3y ago · link · parent

@robocat linked a great video showing how to do this: https://m.youtube.com/watch?v=A-L7KOjyDrE
12345
8