208 karma · joined Dec 13, 2013 (12y ago) · 41 submissions
comment 3y ago · link · parent
https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions....
comment 3y ago · link · parent
Last time I checked, MySQL supported it in more cases. MySQL can also be explicit about it via "lock assertions":
ALTER TABLE ..., LOCK=NONE;
will give an error if the requested operation can't be performed while still allowing concurrent reads and writes to the table (if you're fine with preventing writes you can use LOCK=SHARED).The LOCK clause isn't just an assertion and can actually affect how MySQL performs the operation, but I tend to think of it as asserting "this won't cause downtime by locking this multi billion-row table while it spends an hour rewriting it".
comment 4y ago · link · parent
8.
An io_uring-based user-space block driver(lwn.net ↗)
102 points · by veddan · 4y ago · 38 comments
comment 5y ago · link · parent
Aegisub however has good automation support, and has (had?) a pretty active scripting community. Scripts can do a lot of stuff and often has simple dialog-box UIs. The base scripting support is in Lua, but a lot of scripts are written in a Lua variant called Moonscript. I've never seen it used anywhere else. And, as was mentioned in a sibling comment, there are scripts for importing motion-tracking files into Aegisub.
The ASS format lacks support for a bunch of stuff that people want to do, or the native support is deficient in some manner, so scripting is very important for Aegisub. For example, a line can be given a color gradient by make a one copy of the line for each shade in the gradient (this can be 100+ times). Each copy is then given a different color according to the gradient, and a \clip command is used on each line to only show a 1-2 pixel wide slice of each line. If all those slices are lined up properly and the lines are displayed simultaneously, it gives the impression of being a single line with a color gradient. Tricks like this can actually cause performance problems in rendering the subtitles!
I think this is an interesting little programming niche, but there isn't much complex typesetting being done these days. Tastes have changed, and due to licensed releases there's less need for fansubbing on all but the most niche titles.
comment 7y ago · link · parent
It's a blocklist that all licensed gambling companies in Sweden are required to respect. You add yourself to the list for a certain amount of time, and can't unblock yourself until that time has expired.
comment 10y ago · link · parent
For example, you could have a function
void hash(char *out, const char *in);
with two different possible implementations: a slow one using common instructions, and a fast one using exotic instructions.
You can then can have a resolver like this: void fast_hash(char *out, const char *in);
void slow_hash(char *out, const char *in);
void (*resolve_hasher(void))(char *, const char *)
{
if (cpuSupportsFancyInstructions()) {
return &fast_hash;
} else {
return &slow_hash;
}
}comment 10y ago · link · parent
Some code I just compiled with GCC 6.1.1 had several snippets like this emitted for zeroing with memset:
xor eax,eax
...
rep stos QWORD PTR es:[rdi],rax
and some rep movs for memcpy/memmove.comment 10y ago · link · parent
comment 11y ago · link · parent
comment 11y ago · link · parent
Good
fn inc(a: u32) -> u32 { a + 1 }
fn foo(a: u32, b: u32) -> u32 { let x = a + b; a * x }
Bad fn bar(...) -> bool {
let mut success = false;
let conn = getConnection();
...
if x > y {
return false;
} else if z < q {
success = false;
}
foo.barify(x, y);
...
success
}
It looks especially bad when the function has multiple early returns, and then the final return looks different.comment 11y ago · link · parent
[1] https://wiki.postgresql.org/wiki/UPSERT#SQL_MERGE_syntax