How can I mine my fork of bitcoin since setgenerate was removed

As many of you know, in Bitcoin Core v0.13, the setgenerate command was removed from the bitcoin-qt wallet debug console. This means you can no longer CPU mine from the wallet (for obvious reasons). I am having a ton of fun forking bitcoin and making my own coin just to learn how crypto works, but because setgenerate was removed, I can’t figure out how I am supposed to mine/test my forked crypto.

Before I could just use “setgenerate” and immediately start using my new crypto. Is there some alternative way to do this now that it no longer exists? Do I have to use an external program like CGMiner now?

is wifi-ap module for Raspberry pi has been removed?

I was referring to wifi-ap documentation for raspberry pi setup. Suddenly when I am trying to refer to the document it is a page not found.

I want to know whether the module has been removed or was removed by mistake. If it has been removed I want to know what are the best alternatives for that.

Replacing removed secure empty trash feature

Is this code reliable? Is there any extra precaution I should or should not be taking here? How is my code to securely delete a file by repeatedly overwriting the contents?

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
int main(int Argc, const char *Argv()) {
    unsigned int *RandBuf = NULL;
    for (int I = 1; I < Argc; I++) {
        long FileSize;
        const char *const Path = Argv(I);
        FILE *const File = fopen(Path, "r+");
        if (!File || fseek(File, 0, SEEK_END) || (FileSize = ftell(File)) < 0) {
        const unsigned long IntCount = (FileSize+3)>>2;
        RandBuf = realloc(RandBuf, IntCount<<2);
        const unsigned char WriteCount = ((unsigned int)rand()&0xF)+16;
        for (unsigned char Write = 0; Write < WriteCount; Write++) {
            for (unsigned long Int = 0; Int < IntCount; Int++) {
                RandBuf(Int) ^= (unsigned int)rand();
            if (fseek(File, 0, SEEK_SET) || fwrite(RandBuf, 1, FileSize, File) < FileSize) {
        if (fclose(File) || remove(Path)) {
    return 0;

plugins – How to prevent additional code in functions.php to be removed once there is an update?

Every time storefront is being updated, my additional functions.php code is being removed.

How to prevent additional code in functions.php to be removed once there is an update?

Is there a plugin or is the only way to do it to create a child theme which in itself is a debug-worthy approach?

php – Query String being Removed Creating a Pagination Issue within a Custom Plugin

I created simple custom WordPress plugin for a client in 2016 that simply displays a paginated list of results queried from a custom table.

try {

    $recordcountquery = 'SELECT
            tblBurialRegister WHERE';
    if (!empty($_SESSION('firstname')))
        $cond = $mydb->prepare(' FName = %s', $_SESSION('firstname'));
        $recordcountquery .= $cond; 
    if (!empty($_SESSION('lastname')) && !empty($_SESSION('firstname'))) 
        $recordcountquery .= ' and';
    if (!empty($_SESSION('lastname')))
        $cond = $mydb->prepare(' LName = %s', $_SESSION('lastname'));
        $recordcountquery .= $cond;
    $countresults = $mydb->get_results($recordcountquery);
    $total = count($countresults);

// How many items to list per page
    $limit = 20;

    // How many pages will there be
    $pages = ceil($total / $limit); 
    // What page are we currently on?
    $page = get_query_var('page');
    if($page == 0)
    $page = 1;
    // Calculate the offset for the query
    $offset = ($page - 1)  * $limit;
        // Some information to display to the user
    $start = $offset + 1;
    $end = min(($offset + $limit), $total);

    // The "back" link
    $prevlink = ($page > 1) ? '<a href="?page=1" title="First page">&laquo;</a> <a href="?page=' . ($page - 1) . '" title="Previous page">&lsaquo;</a>' : '<span class="disabled">&laquo;</span> <span class="disabled">&lsaquo;</span>';

    // The "forward" link
    $nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">&rsaquo;</a> <a href="?page=' . $pages . '" title="Last page">&raquo;</a>' : '<span class="disabled">&rsaquo;</span> <span class="disabled">&raquo;</span>';

if (count($countresults) > 0)
echo "<span id='results' class='top-offset'></span><p style='font-size:x-large;'>Showing results for: ".$_SESSION('firstname')." ".$_SESSION('lastname')."</p><br/>";

    // Display the paging information
    echo '<div id="paging" class="paging-text" style="font-size: large;"><p>', $prevlink, ' Page ', $page, ' of ', $pages, ' pages, displaying ', $start, '-', $end, ' of ', $total, ' results ', $nextlink, ' </p></div>';
    $query = 'SELECT
            tblBurialRegister WHERE';
    if (!empty($_SESSION('firstname')))
        $cond = $mydb->prepare(' FName = %s', $_SESSION('firstname'));
        $query .= $cond;    
    if (!empty($_SESSION('lastname')) && !empty($_SESSION('firstname'))) 
        $query .= ' and';
    if (!empty($_SESSION('lastname')))
        $cond = $mydb->prepare(' LName = %s', $_SESSION('lastname'));
        $query .= $cond;
    $query .= ' ORDER BY
        LIMIT '
            . $limit .
        ' OFFSET '
            . $offset .'';
    $results = $mydb->get_results($query);
    // Do we have any results?
    if (count($results) > 0) {
        echo "<div style='overflow-x:auto;'><table style='font-size:large;'><th>First Name</th><th>Last Name</th><th>AGE</th><th></th>";
        foreach ($results as $obj) :
        $age = $obj->AGE;
            $age = 'Unknown';
        $bdate = $obj->DATEBORN;
            $bdate = 'Unknown';
        $ddate = $obj->DDate;
            $ddate = 'Unknown';
        echo "<tr><td>".$obj->FName."</td><td>".$obj->LName."</td><td>".$age."</td><td><form method='post' action=''><button id='myBtn' class='et_pb_contact_submit et_pb_button rsButton' style='color: #424892!important;
    border-color: #424892;' type='submit' name='RecordDetails' value=".$obj->ID.">Details</button></form></td></tr>";
    echo "</table></div>";
    } else {
        echo '<p>No results found.</p>';

} catch (Exception $e) {
    echo '<p>', $e->getMessage(), '</p>';

This code has not been touched since it’s release and has been working. They reported to me in the last few months that the pagination is not working and user’s cannot get past the first page.

It looks to me like the query string is now being removed when a link in the pagination is clicked ie. ?page=2. Perhaps something changed in a WordPress update at some point that changed the behavior of query strings?

I looked into wp_removable_query_args() in functions.php which exists in the plugin like so:

function wp_removable_query_args() {
    $removable_query_args = array(

But my understanding is that this only removes the query strings listed, so page should not be removed. Any help or direction would be appreciated.

tag removed – So i have started investing and i want to know the outcome of my investment

So i have brought around 4000 shares, priced at an average of about 0,04 dollars (4 cents) and i am thinking that if the price rises to 10 dollars per share, and i decided to sell all my shares for that 10 dollars each, then how much would i profit. So my calculation was simple, i have 0,04 price per share and i own 4000 shares, this multiplied by each other and we get how much is the price i paid for all of these shares in total, 160. Now i am stuck, my intention is not to know how much i paid for these shares but how much i make if i sold when the price increases to 10,00 dollars each share and i would still own 4000 so how much can i profit by selling these 4000 shares that were priced at 0,04 cents and now increased to 10,00 dollars.

postgresql – postgres: could not receive data from WAL stream: ERROR: requested WAL segment has already been removed

Configuration: postgres 9.6 with a 3 cluster node. db1 is the master, db2 and db3 are replicas. WAL files are archived in AWS S3 using custom pgrsync tool. Cluster managed by patroni. The archive_command and restore_command is properly configured on all the nodes.

To simulate: On db1, do heavy writes (like vacuum a large table) and then stop db1 by sudo systemctl stop patroni). db3 becomes the new leader. db2 requests more WAL files, which it gets via the proper restore command from AWS S3, becomes replica to db3.

Now, start db1 again by (sudo systemctl start patroni). But db1 (the old leader and the new to-be-replica) never comes up as a replica and gives the error message could not receive data from WAL stream: ERROR: requested WAL segment 0000002400053C55000000AE has already been removed. This error message is reported by db3 (the leader), which db1 just logs it.

So, let’s see the timeline. Initially db1 was in timeline 35 (0x23) and did write the following files to archive:

0000002300053C55000000AE   (TL is 23 and archive at 53C55/AE)
0000002300053C5600000043   (TL is 23 and archive at 53C56/43)

db1 is stopped at this point.
db3’s logs show this:

received promote request
redo done at 53C56/A3FFC8C0
selected new timeline ID: 36
database system is ready to accept connections

and db3 copies the following files to archives


As db3 became leader, db2 starts the process to become replica to db3 (which it successfully becomes) and here is the summary of the logs:

restored log file "00000024.history" from archive
restored log file "0000002300053C55000000AE" from archive
restored log file "00000023.history" from archive
redo starts at 53C55/AE0001A8
restored log file "0000002300053C55000000AF" from archive
restored log file "0000002300053C5600000042" from archive
Retrieving 0000002300053C5600000043 to pg_xlog/RECOVERYXLOG FAILED  (log by pgrsync)
Retrieving 0000002300053C56000000A2 to pg_xlog/RECOVERYXLOG FAILED
restored log file "0000002400053C56000000A3" from archive
consistent recovery state reached at 53C56/A3FFE900

db1 is started now and here are the logs:

LOG: database system was interrupted while in recovery at log time 2021-01-28 04:08:01 UTC 
HINT: If this has occurred more than once some data might be corrupted and you might need to choose an earlier recovery target
LOG: invalid record length at 53C55/AE0001E0: wanted 24, got 0
LOG: started streaming WAL from primary at 53C55/AE000000 on timeline 36
FATAL:  could not receive data from WAL stream: ERROR:  requested WAL segment 0000002400053C55000000AE has already been removed
... and repeats this over and over

Points to note:

  1. 0000002400053C55000000AE was never written to archives by any postgres node. The old leader (db1) copied the archive 0000002300053C55000000AE (note: 0023, not 0024) before it was stopped.
  2. The new leader (db3) copied 0000002200053C55000000AE (note: 0022, not 0024)
  3. max_wal_size is set to 1024 on all nodes.
  4. After db3 became the new leader, there was hardly any activity on the nodes. db3 only writes WAL files every 10 mins (archive_timeout=600s).


  1. Is there any thing wrong in the configuration that makes the the old leader asking for a WAL segment, which the new leader does not have?
  2. How to restore the old leader (db1) at this state, without having to erase and start over?

tag removed – Gas Mileage Question

Thanks for contributing an answer to MathOverflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.