magento2 – Magento 2 Sample Data installation Error

After bin/magento sampledata:deploy;

i m trying to do bin/magento setup:upgrade; Following error thrown.

Unable to apply data patch MagentoGroupedProductSampleDataSetupPatchDataInstallGroupedProductSampleData for module Magento_GroupedProductSampleData. Original exception message: Rolled back transaction has not been completed correctly.

Magento Version is 2.3.4

magento2 – Unable to import the sample data


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




sampling – How to sample a perfect partition uniformly at random?

I would like to sample $n$ integers (of some fixed length, say $k$ bits) uniformly at random, and have them partitioned into two sets of equal sum. Since finding such a perfect partition (even if it exists) is NP-hard, I would like to sample them in advance such that they are partitioned into two sets of equal sum. A naive algorithm is:

  • Sample some integers for the first set; let $S$ be their sum.
  • Sample some integers for the second set, until their sum exceeds $S$; then stop and truncate the last integer sampled so that the sum in the second set is exactly $S$.

The problem is that it does not guarantee that the integers are sampled uniformly at random.

Is it possible to sample two sets with an equal sum, such that each integer has the same chance of being chosen?

How do I convert this code to dynamic WordPress navbar without losing the CSS styles? Here is the sample code:

<ul>
    <li><a href="#">Home </a></li>
    <li class="menu-dropdown"><a href="#">Supplies <i class="ion-ios-arrow-down"></i></a>
        <ul class="sub-menu">
            <li><a href="#">Chemicals</a></li>
            <li><a href="#">Food</a></li>
            <li><a href="#">Apex</a></li>
        </ul>
    </li>
    <li class="menu-dropdown"><a href="#">More <i class="ion-ios-arrow-down"></i></a>
        <ul class="sub-menu">
            <li class="menu-dropdown position-static"><a href="#">Supplies <i class="ion-ios-arrow-down"></i></a>
                <ul class="sub-menu sub-menu-2">
                    <li><a href="#">All</a></li>
                    <li><a href="#">Chemicals</a></li>
                    <li><a href="#">Food</a></li>
                    <li><a href="#">Apex</a></li>
                </ul>
            </li>
            <li><a href="#">About Us</a> </li>
            <li><a href="#">Blogs </a></li>
            <li><a href="#">Contact Us </a></li>
        </ul>
    </li>
</ul>

Web Tour Sample application can i use in mac?

I have a new course is about Software Requirements and Test Technology-1 but teacher told us to use Web Tour application and link is below. But i don’t have windows computer and i also don’t want to use. So, is there any option to use this application in mac or any alternative option.
https://marketplace.microfocus.com/appdelivery/content/web-tours-sample-application

node.js – Unable to set up sample React project correctly?

I got an interview assessment next week and they provided me a sample code project of what to expect. The problem is I’m having a LOT of trouble simply setting it up to run as expected…

The sample project: https://github.com/sduong3/messenger-clone

I cloned the project and installed all dependencies.

Problem 1
I followed the README in which I created a Database called messenger and then created a .env file in the server directory. The problem is I can’t retrieve any values from that .env file through process.env.REACT_APP_CUSTOM_VAR. Console.logging “process.env” does not show ANY custom variables. It’s as if they weren’t even created…

Problem 2
On the frontend side, it should have been simple (npm install and then npm start). When starting, I found that there was NO CSS applied (despite reading the code and there’s Material UI used). When I inspected the page, I’m getting the error ‘The server responded with a status of 431 (Request header fields too large).

I have a hard time believing the company gave me super broken code to the point where I can’t even run the sample code properly… Can anyone please help me and try installing the code project above? Please let me know if you got the same problem or found any solutions!

Sample code to set target audience for Each items in the Spfx webpart

Is it possible to set the target audience for each items in the SPFX webpart. Please let me know if any sample code or article is there for that.

Thanks in Advance!

botnet – ELF/PE32 IoT Malware sample execution & connection to C&C

Currently I am working on an IoT Malware project.

I have collected both ELF and PE32 executables of IoT Malware like Mirai, and Gafgyt from different sources. Now I have to execute these samples in Raspberry pi for dynamic analysis. For Botnets like these, C&C will be there to give them commands. Suppose I am executing these samples, How will all those samples connect to C&C?

I hope my question is clear.

As I am new to security field, it would be really helpful if anyone helps me with this.

linux – IoT Malware ELF/PE32 sample execution & connection to C&C

Currently I am working on an IoT Malware project. I have collected both ELF and PE32 executables from different sources. Now I have to execute these samples in an isolated environment for dynamic analysis. But, I want to know how these malware samples connect to C&C.

As I am new to security field, it would be really helpful if anyone helps me with this.

Sample Breakout Game to introduce students who have covered the AP CS A syllabus to Java Graphics:

I am an AP CS A teacher but as the syllabus does not include Graphics this is really my first time in using Java graphics. I am looking to produce a project not far above the realms of the AP CS A syllabus (classes, inheritance, interfaces, abstract) that will give students an insight into how to produce their own simple games using Java graphics.

I have seen many tutorials on the net but so far nothing as simple as this that I can get my head round and actually truly understand.

Any suggestions on how I could improve the code below without getting too complicated?

Notes:
I am not particularly happy with the infinite loops for example.

Any suggestions would be appreciated.

public class GameTest{
    public static void main(String() args) {
        Game pg = new Game();
    }
}
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import java.awt.event.KeyListener;

public class Game extends JFrame implements KeyListener{

    private final int gWidth = 500;
    private final int gHeight = 400;
    private Dimension screenSize;
        
    private Image dbImage;
    private Graphics dbGraphics;
    
    private Ball ball;
    private Brick()() bricks;
    private Paddle paddle;
    
    private Thread ballThread;
    private Thread paddleThread;
    
    public Game() {
        screenSize = new Dimension(gWidth, gHeight);
        this.setTitle("Let's Play Game!");
        this.setSize(screenSize);
        this.setResizable(false);
        this.setVisible(true);
        this.setBackground(Color.BLACK);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        addKeyListener(this);
        
        bricks = new Brick(2)(10);
        for (int row = 0; row < bricks.length ; row++) {
            for (int col = 0; col < bricks(0).length ; col++) {
                bricks(row)(col) = new Brick((col*50), (100 + (row * 20)));
            }
        }
        
        paddle = new Paddle(450, 390);
        
        ball = new Ball(250, 200, bricks, paddle);
        ballThread = new Thread(ball);
        ballThread.start();
        paddleThread = new Thread(paddle);
        paddleThread.start();
    }
    
    public void paint(Graphics g) {
        dbImage = createImage(getWidth(), getHeight());
        dbGraphics = dbImage.getGraphics();
        draw(dbGraphics);
        g.drawImage(dbImage, 0, 0, this);
    }
        
    public void draw(Graphics g) {
        ball.draw(g);
        paddle.draw(g);
        
        boolean allBricksGone = true;
        for ( Brick() row : bricks ) {
            for (Brick brick : row ) {
                if (brick.getActive()) {
                    brick.draw(g);
                    allBricksGone = false;
                }
            }
        }
        
        if (allBricksGone)
            System.exit(0);
        
        g.setColor(Color.WHITE);
        
        repaint();
    }   
    
    public void keyPressed(KeyEvent e) {
        paddle.keyPressed(e);
    }
        
    public void keyReleased(KeyEvent e) {
        paddle.keyReleased(e);
    }
    
    public void keyTyped(KeyEvent e) {}
}
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;

public class Ball implements Runnable {
    
    private int xDirection, yDirection;
    
    private Paddle paddle;
    
    private Brick()() bricks;

    private Rectangle ballRect;
    
    public Ball(int x, int y, Brick()() bricks, Paddle paddle){
        Random r = new Random();
        
        int rXDir = r.nextInt(1);  
        if (rXDir == 0)
            rXDir--;
            
        setXDirection(rXDir);
            
        int rYDir = r.nextInt(1);
            
        if (rYDir == 0)
            rYDir--;
                    
        setYDirection(rYDir);
        
        ballRect = new Rectangle(x, y, 15, 15);
        
        this.bricks = bricks;
        
        this.paddle = paddle;
    }
    
    public void setXDirection(int xDir){
        xDirection = xDir;
    }
    
    public void setYDirection(int yDir){
        yDirection = yDir;
    }
    
    public void draw(Graphics g) {
        g.setColor(Color.PINK);
        g.fillRect(ballRect.x, ballRect.y, ballRect.width, ballRect.height);
    }
    
    public void collision(){
        if(ballRect.intersects(paddle.getpaddleRect()))
            setYDirection(-1);
            
        for (int row = 0; row < bricks.length ; row++) {
            for (int col = 0; col < bricks(0).length ; col++) {
                if(bricks(row)(col).getActive() && ballRect.intersects(bricks(row)(col).getbrickRect())) {
                    bricks(row)(col).setInactive();
                    setYDirection(-yDirection);
                    break;
                }
            }
        }
    }
                
    public void move() {
        ballRect.x += xDirection;
        ballRect.y += yDirection;
            
        if (ballRect.x <= 5)
            setXDirection(+1);
            
        if (ballRect.x >= 480)
            setXDirection(-1);
        
        if (ballRect.y <= 30)
            setYDirection(+1);
        
        if (ballRect.y >= 385)
            setYDirection(-1);
    }
    
    public void run() {
        try {
            while(true) {
                move();
                collision();
                Thread.sleep(4);
            }
        }
        catch(Exception e) { 
            System.err.println(e.getMessage()); 
        }
    }
}
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;


public class Paddle implements Runnable{

    private int xDirection;

    private Rectangle paddleRect;

    public Paddle(int x, int y){
        paddleRect = new Rectangle(x, y, 50, 10);
    }
    
    public Rectangle getpaddleRect(){
        return paddleRect;
    }

    public void keyPressed(KeyEvent e) {
        if(e.getKeyCode() == KeyEvent.VK_LEFT)
            setXDirection(-1);
                
        if(e.getKeyCode() == KeyEvent.VK_RIGHT)
            setXDirection(1);
    }
    
    public void keyReleased(KeyEvent e) {
        if(e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_RIGHT)
            setXDirection(0);
    }

    public void setXDirection(int xDir) {
        xDirection = xDir;
    }
    
    public void move() {
        paddleRect.x += xDirection;
        if (paddleRect.x <= 10)
            paddleRect.x = 10;
        if (paddleRect.x >= 440)
            paddleRect.x = 440;
    }
    
    public void draw(Graphics g) {
        g.setColor(Color.CYAN);
        g.fillRect(paddleRect.x, paddleRect.y, paddleRect.width, paddleRect.height);
    }
        
    public void run() {
        try {
            while(true) {
                move();
                Thread.sleep(2);
            }
        }
        catch(Exception e) { 
            System.err.println(e.getMessage()); 
        }
    }
}
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

public class Brick {
    
    private int x, y;

    private boolean active;

    private Rectangle brickRect;


    public Brick(int xVal, int yVal){
        x = xVal;
        y = yVal;
        brickRect = new Rectangle(x, y, 45, 15);
        active = true;
    }
    
    public boolean getActive(){
        return active;
    }

    public Rectangle getbrickRect(){
        return brickRect;
    }

    public void setInactive(){
        active = false;
    }
    
    public void draw(Graphics g) {
        g.setColor(Color.WHITE);
        g.fillRect(brickRect.x, brickRect.y, brickRect.width, brickRect.height);
    }
}