HackerTrans
TopNewTrendsCommentsPastAskShowJobs

SmartHypercube

no profile record

Submissions

The Law of Leaky Abstractions (2002)

joelonsoftware.com
1 points·by SmartHypercube·hace 11 días·0 comments

The Death of the Author

en.wikipedia.org
3 points·by SmartHypercube·hace 5 meses·0 comments

Many small queries are efficient in SQLite

sqlite.org
42 points·by SmartHypercube·hace 6 meses·1 comments

Everything you never wanted to know about file locking (2010)

apenwarr.ca
91 points·by SmartHypercube·hace 6 meses·17 comments

Guide to Scroll Anchoring

developer.mozilla.org
2 points·by SmartHypercube·hace 2 años·1 comments

Position-try fallback options and conditional hiding in CSS

developer.mozilla.org
1 points·by SmartHypercube·hace 2 años·1 comments

[untitled]

1 points·by SmartHypercube·hace 2 años·0 comments

Show HN: I made a game testing your prompting skills

app4.hc11.org
10 points·by SmartHypercube·hace 2 años·2 comments

Show HN: Truncate dates and drop timezones in Git commits

github.com
1 points·by SmartHypercube·hace 2 años·0 comments

Golden-Section Search

en.wikipedia.org
1 points·by SmartHypercube·hace 2 años·0 comments

comments

SmartHypercube
·hace 7 meses·discuss
I love SQLite's quality and their docs explaining this kind of things. However, not all parts of SQLite have the same level of quality. I was very disappointed when I found bugs related to its JSON functions (and several other similar bugs related to other features):

SQLite supports a set of JSON functions that let you query and index JSON columns directly, which looks very convenient—but be careful:

1. `json('{"a/b": 1}') != json('{"a\/b": 1}')`

Although the two objects are identical in terms of JSON semantics, SQLite treats them as different.

2. `json_extract('{"a\/b": 1}', '$.a/b') is null`, `json_extract('{"\u0031":1}', '$.1') is null`, `json_extract('{"\u6211":1}', '$.我') is null`

This issue only exists in older versions of SQLite; the latest versions have fixed it.

In many cases you can't control how your JSON library escapes characters. For example, `/` doesn’t need to be escaped, but some libraries will escape it as `\/`. So this is a rather nasty pitfall, you can end up failing to match keys during extraction with seemingly no reason.
SmartHypercube
·hace 9 meses·discuss
I got bitten by this: user agent stylesheet contains "button {align-items: flex-start}" (at least in Chrome). The default behavior is "stretch". Spent an hour debugging why my flexboxs' sizes are wrong. I still want to use correct HTML elements as much as possible, but I do think using <div>s everywhere makes my small side projects so much easier, since I don't have to remember all the non-default behaviors.
SmartHypercube
·hace 2 años·discuss
Safari is the only major browser still not supporting scroll anchoring.
SmartHypercube
·hace 2 años·discuss
A common requirement for tooltips is that they should appear above or below some other elements, depending on the position, in order to make sure they stay inside the screen. CSS now has native support for this.
SmartHypercube
·hace 2 años·discuss
I've always wanted to give IPv6 more chances to see if I can take advantage of its features early, but every attempt has left me very disappointed. Issues I noticed during my recent research:

- GitHub does not support IPv6.

- Docker containers do not have IPv6 by default.

- Many programs default to listening on 0.0.0.0 or 127.0.0.1 when they start, which means they only listen on IPv4. On Linux, listening on :: defaults to listening on both IPv4 and IPv6 simultaneously, but few programs do this. Python asyncio even disabled this feature[1].

- I've always heard that using IPv6 can sometimes lead to high latency or low bandwidth on certain websites, or even resource loading failures. Why isn’t there a convenient tool to compare these differences? It would be great if browsers could switch between IPv4-only, IPv6-only, and dual-stack modes. I’d like to seriously compare the effects on some websites rather than being silently affected.

- Two large ISPs, Hurricane Electric and Cogent, do not have IPv6 peering[2], so they are not interconnected, and many other ISPs have similar issues.

- Very few VPS providers offer /64 IPv6 addresses, which would allow different containers to be assigned freely within a machine. Some only provide a single /128, while others offer very few addresses per machine.

- Many people might only know how to use iptables/nftables for firewalls and forget about IPv6, leading to situations where using IPv6 can bypass the firewall. I’m not talking about issues caused by the lack of NAT (NAT is not a good firewall!), but more generally about cases where you want to disable forwarding between two network interfaces.

I stumbled upon two old posts that I found quite amusing:

In 2011, someone said[3] “It's not terribly useful to have IPv6 only websites at the moment. Check back in 5-10 years though ;)”

In 2014, someone said[4] “The Internet is growing really fast, in a few years, the IPv6 network will be bigger than IPv4, so, with IPv4, you'll be out of the real Internet. Go ahead man! Upgrade your IP!! Change is a good thing.”

[1]: https://github.com/python/cpython/blob/5f5c0b9c23238dc0a1fdb...

[2]: https://adminhacks.com/broken-IPv6.html

[3]: https://www.reddit.com/r/ipv6/comments/gnh69/what_ipv6only_w...

[4]: https://askubuntu.com/questions/309461/how-to-disable-ipv6-p...
SmartHypercube
·hace 2 años·discuss
[flagged]
SmartHypercube
·hace 2 años·discuss
> That's what it is like watching some people try to use LLM's.

Exactly. I made a game testing prompting skills a few days earlier, to share with some close friends, and it was your comment that inspired me to translate the game into English and submitted to HN. ( https://news.ycombinator.com/item?id=41545541 )

I am really curious about how other people write prompts, so while my submission only got 7 points, I'm happy that I can see hundreds of people's own ways to write prompts thanks to HN.

However, after reading most prompts (I may missed some), I found exactly 0 prompts containing any kind of common prompting techniques, such as "think step by step", explaining specific steps to solve the problem instead of only asking for final results, few-shots (showing example inputs and outputs). Half of the prompts are simply asking AI to do the thing (at least asking correctly). The other half do not make sense, even if we show the prompt to a real human, they won't know what to reply with.

Well... I expected that SOME complaints about AI online are from people not familiar with prompting / not good at prompting. But now I realized there are a lot more people than I thought not knowing some basic prompting techniques.

Anyway, a fun experience for me! Since it was your comment made me want to do this, I just want to share it with you.
SmartHypercube
·hace 2 años·discuss
Thank you for your feedback!

However, I'm really confused. I am color blind (red-green) so I always try to make the life of other color blind people (and myself) easier. I hate red and black. When I was young and in school, I find that most people think the contrast between red and black is great, so teachers use red ink to mark our homework, and other students use red ink to mark important parts of their notes. It is very, very difficult for me to tell which line is red and which line is black.

In the article I was inspired by ( https://www.chiark.greenend.org.uk/~sgtatham/quasiblog/findl... ), the author used red and black. I have to try really hard to see which edges are marked. So I don't want to give other color blind people like me a hard time in my game.

I do understand that there are other more rare color blind types (e.g. blue) and I would like to make my game accessible to all users. My experience is that most non-color-blind people also find the contrast between blue and black is enough. I used blue ink instead of red ink to mark important things in school, and teachers and other students can differentiate them easily.

No offense, but may I kindly remind you to check your monitor setup and whether you are color blind? Perhaps there are something wrong with your monitor screen and you are not aware of it?
SmartHypercube
·hace 2 años·discuss
I have been using a small tool I made to hide the time information in my git commits: https://github.com/SmartHypercube/git-date-truncate

It not only sets the timezone to UTC, but also sets the time to 00:00. So my commits will only have date information. I think only saving the date permanently in the git commit is good enough. No need to leak the precise time I made commits.
SmartHypercube
·hace 2 años·discuss
Exact same behavior here. I got it in 24 guesses. New Game doesn't change the color and guesses show NaN%.

(Windows Chrome)
SmartHypercube
·hace 2 años·discuss
If we ignore the information contained in the score numbers, only comparing which score is higher, we could optimize using ternary search (or golden-section search). https://en.wikipedia.org/wiki/Golden-section_search

(Note that binary search does not apply here. This is searching for an extremum, not a zero point.)

    - Start at the range of 0-F, measure the score of 6 and 9 (2 tries)
    - Depending on which is higher, narrow the range to 0-9 or 6-F
    - Suppose the range is 0-9, measure the score of 3 and 6 (1 try. 6 is already measured)
    - Narrow the range to 0-6 or 3-9
    - Suppose the range is 0-6, measure the score of 2 and 3 (1 try. 3 is already measured)
    - The worse case is 3's score is higher. The range is now 2-6. Since 2, 3, 6 are all measured, in the worst case you need 2 more tries for 4 and 5.
    - The other case is 2's score is higher. The range is now 0-3 and 0, 2, 3 are all measured.
So in worst case there are 6 tries per slider. ~5 tries on average. I suspect this can be further optimized but I'll stop here :)
SmartHypercube
·hace 2 años·discuss
> For example, in games and crypto trading programs, I want to classify all computations into two priorities. I need to do an update / render a frame / compute a trading action in every time period.

Sorry if that is not clear enough. The very next sentence in my comment gave do an update and render a frame as examples about games. I'm talking about the typical game loop. In almost all games the program has to do an update and render a frame every 1/30s or 1/60s. Missing the deadline degrades user experience a lot. And this is constantly happening, applies to almost all games. I mention these examples because I believe they are completely different from loading screens which only happen on occasions. These examples make the batch and low-priority garbage collection I was thinking necessary. Loading screens do not.
SmartHypercube
·hace 2 años·discuss
I'm not talking about the loading screen of a video game.
SmartHypercube
·hace 2 años·discuss
Using RCU as the example to motivate GC is interesting. It is essentially transferring the responsibility of freeing from the writer to the last reader, who cannot be determined when compiling. It makes a lot of sense.

But this makes me thinking that, if I want more performance, should I further transfer the freeing from the reader to a dedicated batch process? The readers only update a mark / write into a queue or something. Every once in a while, a batch process collects all garbages and compacts. This way the readers don't have random additional overheads.

> Lies people believe about memory management

> The programmer knows the best times to pause for memory management.

In my experience, there are many programs in which the programmer does know the best times to pause for memory management. For example, in games and crypto trading programs, I want to classify all computations into two priorities. I need to do an update / render a frame / compute a trading action in every time period. If it finishes before the deadline, I have nothing to do now and would like to collect some garbages. If the high-priority thing is using all the available time, for example, when the market is very active, I don't care too much about collecting garbages and would like to defer everything that is not strictly necessary to as late as possible.
SmartHypercube
·hace 2 años·discuss
Who else is clicking "click to start" like me? It turns out you have to choose one of the buttons. I thought they are there to allow me to enable/disable the sound, but they also both act as start buttons.

Didn't know a simple interface with a sound switch and a game start button can be designed this badly.
SmartHypercube
·hace 2 años·discuss
I don't think this is a problem about "discontinuity". It's about the monotonicity of the function from income before tax (and insurance, etc.) to income after tax. So I don't think "sharp threshold" is a problem, as long as the law is "if you are making more than this amount, the extra part should be taxed at a higher rate."

From other comments I learn that some laws indeed do not work like this. Really?! That's awful.