Multithreading – c ++ – "Use & to create a reference" when creating a simple thread

I am trying to create and use a simple thread within a class. When I join the threads, I get the following error message:

Error   C3867   'std::thread::join': non-standard syntax; use '&' to create a pointer to member 

That is the class

class foo {
public:
    void StartStep() {
        std::thread thread1;
        thread1 = thread((this) { this->bar(); });
        thread1.join;
    }
    void bar()
    {
        cout << "bar";
    }
};

The main

int main() {
    foo foo1;
    foo1.StartStep();
}

Thanks a lot

Crack password – problem creating the rainbow table

I am taking a security course and working on a project where I have to use the password cracking tool. I'm using the Rainbowcrack password cracking tool to create rainbow tables, but I get this error message when
I am trying to generate the tables.

"Cannot create file md5_loweralpha # 1-7_0_1000x1000_0.rt"

This is the command I used:

rtgen md5 loweralpha 1 7 0 1000 1000 0

Here is a screenshot:
Screenshot with the error message that appears when creating rainbow tables

I don't know what the problem is, I really need your help.
Thanks a lot.

Graphics programming – creating hierarchical transformation matrices with motion detection data on a skeleton

I'm trying to draw the bones of a skeleton that is animated by motion detection data. I rotate the bones from "bone space" to "rotation axis space". Then apply the rotation of the current pose. Turn it back into "bone space" and then transform the vertices into the parent space of the bone. I draw an axis on each bone to test my current transformation matrix. With the code below it works almost great. The problem is that there appears to be a double axis (bone) that is pulled around the chest area, and it appears that the spine and certain joints are very slightly "squeezed" or rotated incorrectly. I feel that this has to do with the order of my matrix multiplication, but I cannot understand which transformation I am doing out of order.

    Matrix4 axes_space = skeleton_.BoneSpaceToRotAxesSpace(bone_name);
    Matrix4 thisPose = pose_.JointRotation(bone_name);
    Matrix4 bone_space = skeleton_.RotAxesSpaceToBoneSpace(bone_name);
    Matrix4 ctm = parent_transform * axes_space * thisPose * bone_space;

    Matrix4 S = Matrix4::Scale(Vector3(0.15,0.15,0.15));
    quick_shapes_.DrawAxes(ctm * S, view_matrix, proj_matrix);

    Matrix4 child_root_transform = ctm * Matrix4::Translation(skeleton_.BoneDirectionAndLength(bone_name));

    for (int i=0; i

EDIT: An image with the problem has been added. The arms should be straighter on their side, which would turn both shoulder axes equally. Instead, do they seem almost opposite? If instead I draw a ball for each bone, the problem is much more difficult to notice.

Rest position

Function programming – User defined function for analyzing multiple CSVs, creating variables and counting NAs in R.

I have about 100 records with different variables (and different number of variables), but each record has a household ID (hh_ID) as an identifier. Variables represent survey questions. Each CSV represents a different type of survey. I want to write a custom function that counts how often a household has been asked a question and how often it has skipped a question (NA). The problem I have is renaming the variables and counting across CSVs.

Suppose two data frames look like this:

hh_ID <- c(1,1,2,2,2)
question1 <- c(NA,1,0,0,0)
question2 <- c(1,1,NA,0,0)
df1 <- data.frame(hh_ID, question1, question2)

hh_ID <- c(1,1,1,2,2)
question3 <- c(NA,NA,0,0,0)
question4 <- c(1,1,1,NA,NA)
df2 <- data.frame(hh_ID, question3, question4)

I need the final data frame to look like this:

question1_count <- c(2,3)
question1_NAs   <- c(1,0)
question2_count <- c(2,3)
question2_NAs   <- c(0,1)
question3_count <- c(3,2)
question3_NAs   <- c(2,0)
question4_count <- c(3,2)
question4_NAs <- c(0,2)
finaldf <- data.frame(hh_ID,question1_count, question1_NAs,question2_count,question2_NAs,question3_count,question3_NAs, question4_count,question4_NAs) 

So far I have:

# read in each dta file
filenames <- list.files(path=mydirectory, pattern=".*dta")
for (i in 1:length(filenames)){
assign(filenames(i), read_dta(paste("", filenames(i), sep=''))
)}

variable_NA_count <- function(dataset, col_name){
temp <- dataset %>% group_by(hh_ID) %>% summarise(question_count = n()) 
temp1 <- aggregate(col_name ~ hh_ID, data=dataset, function(x) {sum(is.na(x))}, na.action = NULL)
final <- merge(temp, temp1, by = "hh_ID")
return(final)}

frequency <- function(dataset, col_name){
temp <- variable_NA_count(dataset, col_name)
temp <- temp %>% select(question1_count = question_count,
                        question1_NAs = col_name)}

The problem is that each variable name should end with "_count" and "_NAs" without explicitly writing "question1_count = question_count". I have hundreds of variables in CSVs, so I need a function that reads every CSV, reads every column name, counts how often a household has been asked a question and how often they have not answered. I tried different methods like the insert function, but kept bumping into a wall.

Thank you so much!

Info visualization – Guidelines for creating connections between different areas of a user interface

Previous discussion What is an intuitive user interface for connecting UI elements?

We have a web application called Genome Browser and we want to connect different areas of the genome. Since this is a kind of application-specific context, let's imagine a more general idea. Suppose you have two different diagrams and you want to connect points between them

So we can mock that

Enter the image description here

Now what if instead of just one bar chart at the top and bottom, we have two at the top and two at the bottom, the top two linked by their genome region and the bottom two by their genome region. So if we want to make connections between them, there are many cross-sectional elements

Enter the image description here

At this point, the user interface seems pretty messy. There are also other concerns such as

  • The connecting lines have to be drawn in an overlay, and this really limits the interaction with it, as overlays in HTML really mess up your event handling: you have to insert pointer events: none in the overlay to click underlay and can possibly be deactivated, to interact with the overlay. However, this requires manual switching
  • What if we only render the connection lines regardless of the diagrams above and below because we may only care about the connections and the pattern they create more than the actual bar diagrams. In this case, we can only render to a middle section instead of an overlay, but it gets a little confusing what "status" this now has in the app. How can you turn it on and off when it is separated from the lines in the app? above and below?

These are just a few concerns. The overlay often leads to at least visual chaos and conceptual confusion, although in some cases it can also be helpful. Are there guidelines or similar user interfaces in other apps that have this type of concern?

Bitcoin core – creating custom transactions

I am currently learning how to create raw transactions. I can already create standard with Bitcoin Core (0.19.1), but when I wanted to create with custom opcode like this:

asm: OP_HASH160 d0c3f50336b5f109207d722c692191ff86263e96 OP_EQUAL OP_DROP 1
hex: a914d0c3f50336b5f109207d722c692191ff86263e96877551
  1. I have created a raw transaction
createrawtransaction '({"txid":"1c164f99a7cd0fe6dba9a7fe10ad3c2be132a9260d4ccdeaf7e279073946ac52","vout":0})' '{"2MxmdfXx8rKGUmWUwQu59GksMNRdnQiRRM2":0.195}'

020000000152ac46390779e2f7eacd4c0d26a932e12b3cad10fea7a9dbe60fcda7994f161c0000000000ffffffff01e08b29010000000017a9143c98df42d7a69c7fd165aeb6128d45f21eeeac4d8700000000
  1. But when I tried to sign this transaction, an error occurred (I also tried to change the raw transaction from the first step). Here's the result with the changed raw transaction from above, but it still doesn't work
signrawtransactionwithkey '020000000152ac46390779e2f7eacd4c0d26a932e12b3cad10fea7a9dbe60fcda7994f161c0000000000ffffffff0130c11d000000000019a914d0c3f50336b5f109207d722c692191ff86263e9687755100000000' '("$privkey")' '({"txid":"1c164f99a7cd0fe6dba9a7fe10ad3c2be132a9260d4ccdeaf7e279073946ac52","vout":0,"scriptPubKey":"a914d0c3f50336b5f109207d722c692191ff86263e96877551","redeemScript":"001453352afbbaa8cad22304201de8fbcc29e83fb2db","amount":0.02})'

Previous output scriptPubKey mismatch:
OP_HASH160 d0c3f50336b5f109207d722c692191ff86263e96 OP_EQUAL
vs:
OP_HASH160 d0c3f50336b5f109207d722c692191ff86263e96 OP_EQUAL OP_DROP 1 (code -22)

Now I know I'm doing something wrong, but I don't know what and I can't find information on how to do it right. Therefore I have questions:

  1. What am I doing wrong?

  2. Can I create custom transactions using the Bitcoin core, if so how?

  3. How can I use this wallet when I can't use it? I would be grateful for an example

8 – Fill in an entity reference field (media image) in advance when creating a node

I'm trying to open a node creation form (e.g. /node/add/article) and to pre-populate an entity reference field.

My field (field_image) is a Entity reference to a media of type image and the form uses the Media library widget.

I essentially tried to do this through implementation hook_form_alter in a custom module, but nothing I tried worked. I've seen solutions like this. It works with other field types that I have tried. For example:

// Pre-populate Entity Reference field to taxonomy term

$term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
$form('field_category')('widget')(0)('target_id')('#default_value') = $term;

The above works well. But not the following.

// Pre-populate Entity Reference field to Media Image

$media = Drupal::entityTypeManager()->getStorage('media')->load(38);
$form('field_image')('widget')(0)('target_id')('#default_value') = $media;

I also tried just specifying the media ID instead of the entity, but it didn't work.

I also tried the Prepopulate module, but I couldn't get it to work, even though it works with all the other field types I've tried.

Does anyone know if and how this is possible?

Edit: I should perhaps mention that I am not looking for a solution on how to set a default value for this field. The referenced entity must be set dynamically

For reference, here is my full code:

/**
 * Implements hook_form_alter().
 */
function siteconfig_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  if ($form_id == 'node_article_form') {

    // This works
    $term = Drupal::entityTypeManager()->getStorage('taxonomy_term')->load(13);
    $form('field_category')('widget')(0)('target_id')('#default_value') = $term;

    // This doesn't work
    $media = Drupal::entityTypeManager()->getStorage('media')->load(38);
    $form('field_image')('widget')(0)('target_id')('#default_value') = $media;
  }
}

PHP – Error creating payment button – MercadoPago

Some time ago I implemented a MercadoPago payment button on my website that worked perfectly. I received errors in the log out of nowhere and the BTN is not displayed. The error I get is:

2020/03/27 19:58:31 (error) 1286#1286: *3520 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Exception: Wrong type NULL. It should be integer for property sponsor_id in /var/www/html/lib/vendor/mercadopago/dx-php/src/MercadoPago/Entity.php:459
    Stack trace:
    #0 /var/www/html/lib/vendor/mercadopago/dx-php/src/MercadoPago/Entity.php(368): MercadoPagoEntity->tryFormat(NULL, 'integer', 'sponsor_id')
    #1 /var/www/html/lib/vendor/mercadopago/dx-php/src/MercadoPago/Entity.php(483): MercadoPagoEntity->_setValue('sponsor_id', NULL, false)
    #2 /var/www/html/lib/vendor/mercadopago/dx-php/src/MercadoPago/Entity.php(259): MercadoPagoEntity->_fillFromArray(Object(MercadoPagoPreference), Array)

This is my code

MercadoPagoSDK::setAccessToken("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
                         // Crea un objeto de preferencia
                      $preference = new MercadoPagoPreference();
                      // Crea un ítem en la preferencia
                      $item = new MercadoPagoItem();
                      $item->title = 'Plan Test';
                      $item->unit_price = 1;
                      $item->quantity =1;
                      $item->binary_mode = "true";

                      $preference->items = array($item);
                      $preference->save();

If I delete "$ item-> Quantity = 1", the button is printed, but logically, the log shows the error message that I have to enter the number of items.

I checked and couldn't find because of this error.

Thanks in advance

$ 30 for creating a GIF banner.

advertising

don't you do it

Advertise here with CPM banner, CPM email, and CPC context links for just about anything. You can target relevant areas of the website and display ads based on the geographic location of the user, if you wish.

Starts at just $ 1 per CPM or $ 0.10 per CPC.