Hacker News new | past | comments | ask | show | jobs | submit | ceving's comments login


I like this favicon:

    <link rel="icon" href="data:image/png;base64,iVBORw0KGgo=">


Now here's a trick that might actually save some resources by reducing the amount of useless HTTP requests. I wish the article mentioned this instead!


…At the cost of having to add `img-src data:;` to your CSP, which is unsafe.

https://security.stackexchange.com/questions/94993/is-includ...


How is that unsafe exactly?



On HN, reposts are fine (which is to say, aren't treated as dupes) when a story hasn't had significant attention in the last year or so. This is in the FAQ: https://news.ycombinator.com/newsfaq.html.

But it's great to link to examples of past threads, because readers like to look at them—so this was a good contribution! just not with the tag "duplicate".

Edit: basically, there are two disjoint cases when it makes sense to link to a previous submission of the same story:

(1) when a prior submission of the same story had significant attention in the last year or so, then linking to it with the word "duplicate" or "dupe" is helpful;

or

(2) when a prior submission had significant attention more than a year ago, then linking to it with the phrase "past discussion" or "discussed at" (or something like that) is helpful.

(And for completeness: when a submission has not gotten significant discussion, it's best not to link to it at all. There are plenty of those in the archives, and they're mostly harmless.)


Thanks for that last note, it's been my argument for a while and I've had a few discussions with people on that point, e.g., <https://news.ycombinator.com/item?id=40849927>. I'll try to remember this comment to share for those cases.

I'll occasionally note recent prior posts which aren't dupes on account of minimal discussion (< 20 comments, generally), just because I remember those appearances and wasn't immediately sure myself whether or not the present submission counts as dupes or not. E.g., <https://news.ycombinator.com/item?id=33186713>, <https://news.ycombinator.com/item?id=41099760>, <https://news.ycombinator.com/item?id=31864872>, <https://news.ycombinator.com/item?id=41002384>, and <https://news.ycombinator.com/item?id=39242203> all below limits, <https://news.ycombinator.com/item?id=33942714> just over the 1 year threshold.

And for multiple posts on a given topic see: <https://news.ycombinator.com/item?id=41422938> (the indefagitable ChrisArchitect called the dupe, I explained it).

2nd chance queue can also cause confusion, generally not dupes: <https://news.ycombinator.com/item?id=29071219>.


I am wondering what this statement actually means:

> The reverse predicate from this section should not be used in practice - most Prolog implementations actually provide a built-in version which is a lot more performant than our implementation.

I think it can be read as: If you care about speed do not use Prolog, instead write a "built-in" solution.


I can not find an Emacs mode. Does anybody know one?


https://gitlab.com/preserves/preserves/-/blob/main/preserves... -- crude but effective! (I use it all the time)


Then it might be a misnomber. Calling it "stack" instead of "list" might be better.


That is a fair comment.


While the most precise naming might be "a singly linked list representation of a stack", "free list" (https://en.wikipedia.org/wiki/Free_list) is an ancient term of art for this problem.. so much so that wikipedia (at least the version today) even suggests "freelist" all one word as a spelling.

The initial linking together of all free space (also cache friendly, btw) is often called "threading the free list", although this terminology is less standard than "free list" itself.


Exceptions are easier for the programmer. The programmer has to write less and they clutter the code less. But exceptions require stack traces. An exception without a stack trace is useless. The problem with stack traces is: they are hard to read for non-programmers.

On the other side Go's errors are more work for the programmer and they clutter the code. But if you consequently wrap errors in Go, you do not need stack traces any more. And the advantage of wrapped errors with descriptive error messages is: they are much easier to read for non-programmers.

If you want to please the dev-team: use exceptions and stack traces. If you want to please the op-team: use wrapped errors with descriptive messages.


Messages and stack traces in the error are orthogonal to errors-as-values vs. exceptions for control flow. You could have `throw Exception("error fooing the bar", ctx)`. You could also `return error("error fooing the bar", ctx, stacktrace())`. Stack traces are also occasionally useful but not really necessary most of the time IME.

Go's error handling is annoying because it requires boilerplate to make structured errors and gives you string formatting as the default path for easy-to-create error values. And the whole using a product instead of a sum thing of course. And no good story for exception-like behavior across goroutines. And you still need to deal with panics anyway for things like nil pointers or invalid array offsets.


Go messages are harder for both devs and users to read. Grepping for an error message in a codebase is a special hell.

Besides, it's quite trivial to simply return the exception's getMessage in a popup for an okay-ish error message (but writing a stacktrace prettifier that writes out the caused by exception's message as well is trivial, and you can install exception handlers at an appropriate level, unlike the inexpensibility of error values)


I tend to use "catch and re-raise with context" in Python so that unexpected errors can be wrapped with a context message for debugging and for users, then passed to higher levels to generate a stack trace with context.

For situations where an unexpected error is retried, eg, accessing some network service, unexpected errors have a compressed stack trace string included with the context error message. The compressed stack trace has the program commit id, Python source file names (not pathnames) and line numbers strung together, and a context error message, like:

[#3271 a 25 b 75 c 14] Error accessing server xyz; http status 525

Then the user gets an idea of what went wrong, doesn't get overwhelmed with a lot of irrelevant (to them) debugging info, and if the error is reported, it's easy to tell what version of the program is running and exactly where and usually why the error occurred.

One of the big reasons I haven't switched from Python to Go for HashBackup (I'm the author) is that while I'd love to have a code speed-up, I can't stomach the work involved to add 'if err return err("blah")' after most lines of existing code. It would hugely (IMO) bloat the existing codebase.


I like this:

> A great standard library is a cornerstone of your PL success.


Try Droid48 on your phone. It works for me after I cracked a number key of my HP48GX.


Oh, I’ve tried using emulators, but without the actual physical keyboard it’s just not the same.


Someone reinvented tramp-mode.


I suggest you try it and compare it to tramp-mode and see for yourself how different it is(and just how much better it is to tramp-mode)


This appears to be a significantly better implementation. Tramp mode is god awful slow and does not maintain a persistent connection.


The default setup is pretty crappy but with some tweaking of the ssh connection setup, It does a decent job and I used it for actual work for several years.


Would you mind outlining the settings or pointing to a reference?


It's been a long time. Most of the stuff I was able to get from conversations on the Emacs IRC channel of freenode. Many of those "tricks" are documented here https://www.emacswiki.org/emacs/TrampMode but I don't know if it's out of date.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: