HackerTrans
TopNewTrendsCommentsPastAskShowJobs

w23j

no profile record

Submissions

Social Media Recalibrates How the Brain Values Mental Effort

neurosciencenews.com
3 points·by w23j·8 ngày trước·0 comments

comments

w23j
·2 tháng trước·discuss
CTF stands for Capture the Flag. So with that definition you have exactly zero more information about the article then without it. So I assume next you want a short description of what it actually means, like "CTF (Capture the Flag) are security competitions where the objective is to break...", which is completely ridiculous to include in an article aimed specifically at the CTF crowd.
w23j
·2 tháng trước·discuss
For people who are confused by this comment: lol = laughing out loud!
w23j
·7 tháng trước·discuss
That's the main reason, why I hope Google does not win this AI war.
w23j
·8 tháng trước·discuss
I mean the inner select uses "limit 1", right? So it will usually (but not always as I said in another comment) only delete and return a single task.
w23j
·8 tháng trước·discuss
We use a similar approach.

Fun fact: A query like this will, once in a blue moon, return more than limit (here 1) row, since the inner query is executed multiple times and returns different ids, which is surprising for a lot of people. If your code does not expect that, it may cause problems. (The article seems to, since it uses a list and iteration to handle the result.)

  delete from task
  where task_id in
  ( select task_id
    from task
    order by random() -- use tablesample for better performance
    for update
    skip locked
    limit 1
  )
  returning task_id, task_type, params::jsonb as params 
You can avoid that by using a materialized Common Table Expression. https://stackoverflow.com/questions/73966670/select-for-upda...

Also, if your tasks take a long time, it will create long-running transactions, which may cause dead tuple problems. If you need to avoid that, you can mark the task as "running" in a short-lived transaction and delete it in another. It becomes more complicated then, since you need to handle the case that your application dies while it has taken a task.
w23j
·8 tháng trước·discuss
This file from chapter 1 cannot be opened: arch/x86/kernel/entry_64.S ("Failed to load file").

It's also not visible in the directory tree on the left.

(Oddly enough another comment mentioned this already and is voted dead. Why?)