• 1.23K Posts
  • 1.04K Comments
Joined 3 years ago
cake
Cake day: June 11th, 2023

help-circle
  • Stockfish and RubiChess agree that Qb3 is the best move. RubiChess (blue arrows) is only considering attacking while Stockfish (green arrows) has Kh2 and Kh1 in its top moves (+6.25 and +6.99 versus +6.57 for Qb3).

    I think the general idea is that the black rook on e8 implies the strategy to get that rook to e1. The move Kh2 avoids that check.

    I don’t really find that argument convincing myself. White is clearly ahead so just increase the pressure and black will probably have no time for a counterattack anyways.












  • copacetic@discuss.tchncs.detoProgrammer Humor@programming.dev#NULL!
    link
    fedilink
    English
    arrow-up
    18
    ·
    edit-2
    13 days ago

    If you use the SQLite C API like this

        char query[256];
        snprintf(query, sizeof(query),
                 "SELECT * FROM users WHERE username = '%s'", username);
        int rc = sqlite3_exec(db, query, NULL, NULL, &err_msg);
    

    and someone enters Robert'; DROP Table Students;-- as username, it deletes the table Students.

        const char *sql = "SELECT * FROM users WHERE username = ?";
        int rc = sqlite3_prepare_v2(db, sql, -1, &stmt, NULL);
        if (rc != SQLITE_OK) {
            fprintf(stderr, "Failed to prepare statement\n");
            return;
        }
        sqlite3_bind_text(stmt, 1, username, -1, SQLITE_STATIC);
    

    Using this “prepared statement” and “bind”, your code is secured against such SQL injection attacks.