Reversing network hashpower – Bitcoin Stack Exchange

I’m reading this article by Vitalik Buterin on Problems in Cryptocurrency and don’t quite understand what this means:

Ideally, after some number of blocks (perhaps logarithmic in the total size of the network) every transaction should require 51% of network hashpower to reverse. However, solutions where transactions can pay very small fees for a lower “level” of security are acceptable, though one should take care to avoid situations where an attacker can profit by performing one attack to reverse very many small transactions at the same time

I understand that Sybil attack can happen if more than 51% of the network is under one person’s control, but I don’t understand what it means to reverse network hashpower, and why 51% of it should be reversed.

Most memory-efficient Hashset implementation? – Stack Overflow

I’m looking for the most memory-efficient Hashset/Hashmap/unordered-set implementation in any language that still maintains near-O(1) lookup. My favorite language is C#, so I’ve been looking at that for now. My particular use case is storing large numbers of ulongs (representing 64-bit hashes) for fast lookup. In C#, it seems that the actual memory usage is approx 2.5x actual data. For example, if I store 100 million longs in a hashset, the raw data is 800 million bytes, but the actual memory usage is about 2GB (that’s with .NET framework 4.8’s addition of allowing a perfectly-sized hashset; otherwise it takes over 4GB). My question is: is there an implementation in any other language that has <2.5x data overhead?

SQL CONSULTA MULTITABLA – Stack Overflow en español

select OEHR_CUSTOMERS.cust_first_name ||' '|| OEHR_CUSTOMERS.cust_last_name, count(OEHR_ORDERS.order_id)
from OEHR_CUSTOMERS LEFT JOIN OEHR_ORDERS ON OEHR_CUSTOMERS.customer_id=OEHR_ORDERS.customer_id
where OEHR_ORDERS.order_id > 4
group by cust_first_name, cust_last_name, order_id

Necesito sacar los clientes que han hecho 4 o más ordenes. Ayudaaaa
introducir la descripción de la imagen aquí

Native debug on Android – Android Enthusiasts Stack Exchange

It has been a few years since I last needed to debug any native applications on Android. After poking around a bit I found this Google reference referring to gdbserver and gdbclient.py.

I found the former in the NDK

$NDK/prebuilt/android-arm(64)/gdbserver/gdbserver

And the latter in the SDK

$SDK/development/scripts/gdbclient.py

When I went to run the python script I am met with:

$ python gdbclient.py
Traceback (most recent call last):
  File "gdbclient.py", line 27, in <module>
    import gdbrunner
ImportError: No module named gdbrunner

For the life of me I cannot find any information on what gdbrunner is. Nor have I found any other reference to it in the (S/N)DKs.

Any idea? Is there another method to debug native components of Android not reliant upon this script?

Physics’s system – Game Development Stack Exchange

Thanks for contributing an answer to Game Development Stack Exchange!

  • 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.

Update SQLITE table – Database Administrators Stack Exchange

I want to update my sqlite table and I use a request with conditionals my purpose is to set the name to the new value when the value is not null and keep the old value if the new value is null .
I would like anybody check my request to see if there is something wrong cause I’m getting errors

The request below :

UPDATE user SET name = CASE WHEN (? = NULL) THEN user.name ELSE ? END  WHERE ID=? ;

python – Kinematics Simplification – Code Review Stack Exchange

So I created a one dimensional kinematics equation solver which has been successful, however was interested in simplifying my code. My code works once user inputs the the given variables, then boolean tests the provided variables to provide the appropriate equation used to solve, based on the missing variable which is not included in the given problem. I would appreciate any recommendations for my code, I have considered creating lists were each element is a boolean condition, but ultimately seems longer than my current versionenter image description here

def something:
for code in picture:
look at code

Adicionar @Html.DropDownList usando Jquery – Stack Overflow em Português

Eu tenho uma função para inserir um tr/td.
Eu preciso inserir um @Html.DropDownList mas do jeito que tentei não está funcionando.
Estou usando C# com bootstrap no Visual Studio.

    function AddItem() {
    var nItem = Number($("#nItem").val()) + 1;
    $("#nItem").val(nItem);
    var div = document.createElement('tr');
    div.innerHTML = '<td><input type="text" class="item-control" id="Item" name="Item" value="' + nItem + '" style="width:32px;background-color: #e9e9e9;text-align: center" readonly /></td>';
    div.innerHTML += '<td colspan="2"><input type="text" class="item-control Qtd" id="Qtd_' + nItem + '" name="Item" value="0" /></td>';
    div.innerHTML += '<td colspan="2">@Html.DropDownList("UnMedId", null, "-", htmlAttributes: new { id = "UnMed_", Name = "Item", @class = "form-control" })</td>';
    document.getElementById("itens").appendChild(div);
}

Obrigado!

VanityURL checker in Python – Code Review Stack Exchange

This is a good start for a script. The next step should be separating in-/output from the functions doing the actual work.

In addition, whenever you make multiple requests to the same server, you should use a requests.Session, which will re-use the connection. You can also pass a dictionary params which will be the URL-encoded parameters for the request. The Session can take a default value for that.

You should always use with when opening a file or resource. This way it is ensured that it is closed properly, even if an exception occurs during the intervening code.

You can write multiple rows at once using writelines. You can even pass an iterable to this function and it will iterate for you.

I would write your script something like this:

import requests

URL = "https://api.steampowered.com/ISteamUser/ResolveVanityURL/v0001/"
PARAMS = {"key": "removed"}

def url_available(session, url):
    response = session.get(URL, params={"vanityurl": url}).json()
    return response('response')('success') == 42

def main():
    session = requests.Session()
    session.params = PARAMS
    with open('ok.txt') as in_file, open('www.txt', 'w') as out_file:
        out_file.writelines(url for url in in_file
                            if url_available(session, url.strip()))

if __name__ == "__main__":
    with Timer("main"):
        main()

To this you should add a docstring to each function describing what it does, but that is left as an exercise :).

Here Timer is a simple class that starts a timer when the context is entered and reports the result when the with block is finished:

from time import perf_counter

class Timer:
    def __init__(self, name):
        self.name = name

    def __enter__(self):
        self.start = perf_counter

    def __exit__(self, *args):
        diff = round(perf_counter() - self.start, 2)
        print(f'{self.name} finished in {diff} second(s)')