Will the Bitcoin network discredit a transaction if you do a simple transfer on a multi-sig after you found the collision on that address?

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Develop a simple serious game to dedramatize git merge conflict

I’m creating a course on GIT for non computer scientist.
As you know, developper already fear merge conflict (Do developers fear merge conflicts?), so that even worse for non computer scientist (ex in Humanity…)

So, i decide to take some time to think/build a scenario to de-dramatize this common problem, by creating a serious game.

After many hours to search on boardgamegeek website, i’m convainced that there already exist some game/mechanisms on abstract boardgame that adapt well to merge conflict.

The game need to be played using a board game representend as a text/Ascii file. This text file / Ascii file is synchronized with all users, and all users have a local copy of this file on their computer. Each users could change the text file at any time and push/sync the modified file/board on the server. Each push from users to the server generate a new state for the boardgame. There is no problems until two user change the same line on the board …

My Objective was to generate “git merge conflict” and “conflict resolution” when multiple players try to compete for one shared resource.

My actual finding (26/10/2020) :

  • I found that “Pent a rush” or “5er-finden” (see “https://boardgamegeek.com/boardgame/285535/5er-finden” was interesting because there is one board with pattern shared for all users, and all users have limited time to report their finding on the local board to win the step.

So if someone find a pattern and report it before you and before the end of time for this step, you need to resolve a conflict by accepting the other player answer.

Real time playing, with auction/bidding mechanism. Players acquire ownership of sections of city blocks then place tiles, representing businesses, onto the shared block-sections. So there is competition between users.

If you already think or develop something related to de-dramatize git merge-conflict, or if you have a game with some of these caracteristic in mind, i’m interested to share expertise here as community post.

Ps : I also cross post and open discussion here :
https://boardgamegeek.com/thread/2527651/adapt-board-game-mecanism-serious-game-learn-git-c

A simple HTML/PHP form application

I’ve been having issues making the HTML portions of the following PHP file display. I’m not expecting full functionality at all, I’m simply trying to make the labels and text areas show — but instead, the site is completely blank. What am I doing wrong?

<body>
<?php
function validateinput($data, $fieldname) {
    global $errorcount;

    if (empty($data)) {
        echo ""<code>$fieldname</code>" is a required field.<br>n";
        ++$errorcount;
        $retval = "";
    }

    else {
        $retval = trim($data);
        $retval = stripslashes($retval);
        $retval = htmlspecialchars($retval);
    }

    return($retval);
}

function displayform($sender, $email, $subject, $message) {
    ?>
    <h2 style="text-align:center">Contact Me</h2>
    <form name="contact" action="contactform.php" method="post">
        <p>
          <label for="sender">Name:</label>
          <input type="text" id="sender" name="sender" value="<?php echo $sender; ?>">
        </p>
        <p>
          <label for="email">E-Mail Address:</label>
          <input type="text" id="email" name="email" value="<?php echo $email; ?>">
        </p>
        <p>
          <label for="subject">Subject:</label>
          <input type="text" id="email" name="subject" value="<?php echo $subject; ?>">
        </p>
        <p>
          <label for="message">Message:</label>
          <br>
          <textarea name="message" id="message">
          <?php echo $message; ?>
          </textarea>
        </p>
        <p>
          <input type="reset" value="Clear Form">
          <input type="submit" name="submit" value="Send Form">
        </p>
    </form>
    <?php }

$showform = TRUE;
$errorcount = 0;
$sender = "";
$email = "";
$subject = "";
$message = "";

if (isset($_POST('submit'))) {
    $sender = validateinput($_POST('sender'), "Name");
    $email = validateinput($_POST('email'), "E-Mail Address");
    $subject = validateinput($_POST('subject'), "Subject");
    $message = validateinput($_POST('message'), "Message");

    if ($errorcount == 0) {
        $showform = FALSE;
    }

    else {
        $showform = TRUE;
    }

    if ($showform == TRUE) {
        if ($errorcount > 0) {
            echo "<p>Please re-enter the form information below.</p>n";
            displayform($sender, $email, $subject, $message);
        }
    }

    else {
        $senderaddress = "$sender <$email>";
        $headers = "From: $senderaddressnCC: $senderaddressn";
        $result = mail("test@test.com", $subject, $message, $headers);

        if ($result) {
            echo "<p>Your message has been sent. Thank you, " . $sender . ".</p>";
        }

        else {
            echo "<p>There was an error sending your message. Please try again.</p>";
        }
    }
}
?>
</body>

I’ve also tried de-bugging on an online compiler, but there are no errors. Hosted here: http://sandbox.onlinephpfunctions.com/code/1bd5b1421668efeba7f789329f2a71027f43c061

cryptography – Help identify a simple, reversible cipher/encryption algorithm

my genius friends!

I’m trying to help a small business transition out of an obsolete, obscure piece of software, and app support is, unfortunately, non-existent. To fully export the data for the new system, I need to be able to decrypt/decipher a string in one of the database fields. But cryptography is not my specialty and I have not been able to reverse engineer what seems to be a very simple encryption/cipher algorithm.

I can create plaintext strings using the app, then see what they look like encrypted in the database. I can copy the encrypted string from one database record to another and it still decrypts just fine no matter which record I open in the app. This suggests to me either the method is keyless, or it’s a static/hardcoded key which is always the same. It smells like some kind of XOR method but I can’t fully put my finger on it even though analysis of the input and output has provided significant clues.

The encrypted output is always a hexadecimal string with a length which is a multiple of 16. For example, a 1-to-7-character input produces a 16-character hex output. An 8-to-15 char input produces a 32-char hex output. A 16-to-23 char input produces a 48-char hex output. Note that while some of the sample inputs are numeric, they are strings.
Notice also that some of the output hex strings have the same endings or beginnings as others despite their inputs being different.

I am sure someone with a bit more experience than myself can sniff out the encoding algorithm in a jiffy. So here are some sample plaintext inputs and encrypted/ciphered outputs. What can you tell me?

Samples:

INPUT (PLAINTEXT STRING)   OUTPUT (HEX STRING)
=================================================================
0                          3603B5C0D407A6FF
1                          9034469951F9BDB6
2                          101080C2FB110A89
0000000                    8AB449F106D5F76A
00000000                   87E0460F100F7E5B7783D03238923053
000000000000000            87E0460F100F7E5B8AB449F106D5F76A
This is a sample string.   D9E1588915C9B1E00D688CBCA066B18D70DC39F1072896F77783D03238923053
Hello, world!              108350BBCE7441DB9BB6235DADC206B5
Bazinga!                   2C03D5CBAAEA807D7783D03238923053

I would be happy to supply any other sample input/output by request.

First one to solve this gets a cookie!

android – Adding simple whatsapp share Button to WordPress

I tried all the Information I could find. But im too stupid to make it work. Im not a programmer. Would love to offer my readers on my blog a share button to whatsapp.

the following was working half way.

<a href="whatsapp://send?text=The text to share!" data-action="share/whatsapp/share">Share via Whatsapp</a>

its opening whatsapp but its not fetching the current page url link.
how could I make this work?
to share easy and fast current page urls via whatsapp as a link. in best case in android and ios.

Thanks for any help

I will create 10 original and simple business name ideas for you for $5

I will create 10 original and simple business name ideas for you

Selecting the right name when starting a business no matter the service you offer is a crucial step in your entrepreneurial journey, as your business or brand name can lead to the success of your business as well as mar it. I will help you make your Business naming a success by providing you with catchy, unique and original names you can choose from.

I will do extensive market research to understand and know your competition and then I’ll develop 10 different unique and original business name ideas as well as slogans you can use to present your business, service or product that works for both short and long term. I’ll check for names that do well in your industry and brainstorm suggestions that grab attention and help you make more sales.

NOTE: I do not use Name generators. All my services are developed from scratch.

BONUS OFFER: I will suggest catchy slogans for your business that will help you drive more traffic and more sales to your business for free!!

MY 2 GIG EXTRAS INCLUDE:

  • I WILL CHECK FOR DOMAIN AVAILABILITY OF EACH NAME (.COM OR ANY DOMAIN NAME YOU WANT)
  • I WILL CHECK FOR SOCIAL MEDIA AVAILABILTY OF EACH NAME

If you have any more question, kindly message me for more information.

ORDER NOW WITH 100% CONFIDENCE. LET’S GET YOUR BUSINESS UP AND RUNNING

.(tagsToTranslate)logo(t)logodesign(t)graphics(t)business(t)businessname(t)brand

c++ – Simple Boolean “Latch” with state

Sometimes you need to do things when a condition changes, here is a simple class to keep track of the state of the last call and execute callbacks when the state changes.


#include <functional>
#include <cassert>


/// latch is a class that contains of a test function and a couple of callbacks, when the return
/// value of the test function changes the approrpiate callback gets called, as long as the return
/// value of the test function stays the same no callbacks will be called. Callbacks may be nullptr
template<class...Args>
class Latch {
public:
    Latch(std::function<bool(Args ...)> shouldLatch, std::function<void(Args...)> onLatch = nullptr, std::function<void(Args...)> onUnlatch = nullptr) :
                m_shouldLatch(std::move(shouldLatch)),
                m_onLatch(std::move(onLatch)),
                m_onUnlatch(std::move(onUnlatch)) {}

    bool latched() const noexcept { return m_isLatched; }
    
    explicit operator bool() const noexcept { return m_isLatched; }

    void update(Args&& ... args)
    {
        if (m_shouldLatch && m_isLatched != m_shouldLatch(std::forward<Args>(args)... ))
        {
            m_isLatched = !m_isLatched;
            auto& call = (m_isLatched) ?  m_onLatch : m_onUnlatch;
            if (call) call(std::forward<Args>(args)...);
        }
    }


private:
    bool m_isLatched = false;
    std::function<bool(Args ...)> m_shouldLatch;
    std::function<void(Args ...)> m_onLatch;
    std::function<void(Args ...)> m_onUnlatch;
};

int main() 
{
    int onLatch = 0;
    int onUnlatch = 0;
    int latchVal = 1;


    Latch<int> l1((&latchVal)(auto val){return val == latchVal;},
                  (&onLatch)(auto val){++onLatch;},
                  (&onUnlatch)(auto val){++onUnlatch;});
    assert(!l1);
    l1.update(0);
    assert(!l1);
    assert(onLatch == 0 && onUnlatch == 0);
    l1.update(1);
    assert(l1.latched());   
    assert(onLatch == 1 && onUnlatch == 0);
    l1.update(1);
    assert(onLatch == 1 && onUnlatch == 0);
    l1.update(0);
    assert(onLatch == 1 && onUnlatch == 1);

    Latch l2 = l1;
}

This is also at https://www.godbolt.org/z/z4b934

Thanks for the input

Simple C++ Dynamicly allocated Matrix with only one memmory allocation

I was bothered withe existing matrix allocation methos that take variable rows and columns, so I made a small class that only needs one memory allocation.


template <typename T>
class Matrix{
    T* data;
    size_t rows, columns;

public:
    Matrix(const size_t rows, const size_t columns) : rows(rows), columns(columns) {
        // One single allocation to store data
        data = new T(rows+columns + 1);
    }

    T* operator()(const size_t r) {
        return data+(r*columns);
    }
};

// Example

int main() {

    Matrix<int> mat(5,3);

    mat(2)(1) = 1;

    //...

}

Making an HYIP program is now very simple and easy – HYIPs

Making an HYIP program is now very simple and easy. Just get a complete package Of HYIP from Zeligz Web Store at an affordable price and you will get the working website within 24 hours. Their HYIP Script is the most advanced in the HYIP market. With the script, you will get many other facilities and features. They have a live support system so you can contact them at any time for any support. Visit their website and get the details now.
 

jsonp – Simple Java HTTP Server application that responds in PJSON

I want to create a very simple HTTP server Java with PJSON responds.
Here is the code:

public static void main(String() args) throws Exception {
     HttpServer server = HttpServer.create(new InetSocketAddress(8500), 0);
      HttpContext context = server.createContext("/test");
      context.setHandler(Sample::handleRequest);
      server.start();
     System.out.println(" Server started on port 8500");
    }    
 
 private static void handleRequest(HttpExchange exchange) throws IOException {
      JSONObject json = new JSONObject("{"weight":"23400"}");
      exchange.getResponseHeaders().add("Access-Control-Allow-Origin", "*");
      exchange.getResponseHeaders().add("Access-Control-Allow-Headers","origin, content-type, accept, authorization");
      exchange.getResponseHeaders().add("Access-Control-Allow-Credentials", "true");
      exchange.getResponseHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
      exchange.getResponseHeaders().set("contentType", "application/json; charset=UTF-8");
      exchange.sendResponseHeaders(200, json.toString().getBytes().length);
      OutputStream os = exchange.getResponseBody();
      os.write(json.toString().getBytes());
      os.close();
  }

and client:

$(document).ready(function () {
        $.ajax({
            url: 'http://localhost:8500/test/',
            type: "GET",
            dataType: "jsonp",
            data: { no: 120 },
            contentType: 'application/json',
            success: function (data) {
                $('#txtWeight').val(data);
            },
            error: function (err) {
                console.log( err);
            }
        });
    });

The problem that I have is related to the HTTP Handler. The Chrome returns:
Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:8500/test/?callback=jQuery34109210173679568667_1603222391566&no=120&_=1603222391567 with MIME type text/plain

Could you please have a look and tell me if something is wrong?