Simple web frontend for editing mysql data?

Hi, I am looking for a web interface to edit mysql data. Something like phpMyAdmin, but it's too big and technical. I just love to edit, delete or generate new entries from a mysql table in a hidden area of ​​my website. Are there easy libraries? I don't want to program it myself.

Is there a simple way to change the network name of a stack by OpenStack?

I created a stack by OpenStack with network1, now I have to change the network to network2.

I don't know if the neutron from OpenStack took can do it directly. Or delete the stack and create it again with a new network.

What is the easiest way?

dslr – Why a pentaprism and not a simple flat mirror?

It is important to understand that the image through the lens is reversed in both sides (X ↔︎ -X) and vertical (there ↔︎ -y) dimensions. Mathematically, this is equivalent to a 180 ° rotation around the z-axis (optical axis).

So the vertical image enter the lens, after having been refracted and focused, leaves the lens has flipped both vertically and horizontally. In order to view the image correctly, some sort of lens or mirror arrangement will need to perform an additional left-right and inversion from top to bottom.

A periscope mirror system performs two up-down mirror inversions, leaving the output image identical to the input, which means that a periscope is only one Translation of the image, but does not transform the output image with respect to the input image.

If you were using the focus screen on an old SLR (one without pentaprism / pentamirror) or a TLR camera, such as a Rolleiflex, you would see a correct image from top to bottom (i.e. – say the sky is at the top of the image in the focus screen), but is reversed from left to right. Indeed, the 45 ° reflex mirror that aims at the image vertically does not transform the image from left to right. It essentially cancels the up-down inversion effected by the lens, leaving only the left-right inversion of the lens.

So the picture entering the pentamirror / pentaprism above a typical DSLR or DSLR is correct from top to bottom, seen looking down on the focus screen. But if you cut a periscope in half and looked at the first mirror, the image would be reversed from top to bottom (but not from left to right).

So the difference between a periscope system and a reflex mirror in the body plus a pentaprism / pentamirror towards the viewfinder is that the pentamirror includes an additional inversion from top to bottom to produce an image which is correct vertically, compared to the periscope system, waiting for a correct image enter the periscope system.

Note: In SLR cameras, the pentaprism / mirror is also a roof style mirror, which performs a single left-right inversion in the middle of all the rebounds around. Essentially, one of the reflective faces of the pentaprism / mirror system is actually not a single reflective surface, but an interior corner at a 90 ° angle that bounces light laterally, as well as vertically. I guess you could technically say that the prism / mirror is no longer penta-faced and more hexa-face. But I like the current nomenclature of roof pentaprism to indicate that the main light path is inside a 5-sided polygon, with the addition / adjective of the roof feature which accomplishes a secondary objective of fixing the image in the left-right plane.

What are the simple and effective CSS tricks to customize the modern share point with the script editor?

Battery exchange network

The Stack Exchange network includes 175 question and answer communities, including Stack Overflow, the largest and most reliable online community for developers who want to learn, share knowledge and develop their careers.

Visit Stack Exchange

Mathematica Returns Long, Uneditable Solutions for Two Simple Quadratic Equations

I tried to get a positive solution (or any solution) of the following two quadratic equations with two variables, my code was:

Solve((1/8)(-A1+x2+α+x1(-2+β)-2βx2^2-θx1^2==0 && (1/16)(A1+3x2-α-2βx2+x1(-2+3β))^2-θx2^2==0, {x1, x2})

This shows that there is a big output, then I clicked on display the full output, it took 5 minutes to display … and the result is in strange format, it doesn & # 39; There is only one symbol in each line in the last part, and they are very difficult to identify, I can't even find where x2 appears

Contest – $ 15 simple design contest

Hi,

I'm looking for someone to design player cards for my website.

The website is a fantastic football (soccer) website and the cards should show players with key information. I like the designs used on FIFA Ultimate Team as below (please don't just copy this).

(IMG)

The information that must appear on the card is:

  • Player name (either full name / just last name.
  • Position (M or midfielder)
  • Their team badge.
  • Their nationality flag
  • Head image
  • Points (number of points they have earned, this can be 100+ so make sure there is room.

Here's what I need for the designs:
– The design must work with several different card colors, we will highlight special cards.
– please do not copy the sample card above.
– Delivery is expected in transparent PSD and PNG.
– The design must be an original work only.
SEMrush

I will provide comments for submissions. The winner if / when chosen is paid via Paypal.

Thank you

optimization – Formulate a simple linear function program

assume: $ g: (1,10) rightarrow mathbb {R} $

$ g (y) = begin {cases}
4y-1 & 1 leq y leq 2 \
3y + 1 & 2 leq y leq 3 \
y + 7 & 3 leq y leq 10
end {cases} $

Now leave $ d in mathbb {R ^ n} $ and that Q is a polyhedron $ subset {y in mathbb R ^ n: 1 leq dy leq 10 } $.

(This is my opinion, there is a typo and it should read $ d in mathbb {R} text {and} y in mathbb {R}, text {not} mathbb R ^ n $, so I guess $ d in mathbb {R} $ and $ y in mathbb R $)

Question: Formulate a linear program: $ max_ {y in Q} g (dy) $

My answer:
I know it $ g (y) $ is piecewise linear concave, I think, so I can express $ g (y) = min {4y-1, 3y + 1, y + 7 } $.

L & # 39; writing:
$ g (dy) $ returns: $ g (dy) = begin {cases}
4y-1 & 1 leq dy leq 2 \
3y + 1 & 2 leq dy leq 3 \
y + 7 & 3 leq dy leq 10
end {cases} $

($ textbf {I don't know if this is correct, I hope it is} $)

I can also express $ g (dy) = min {4y-1, 3y + 1, y + 7 } $

Therefore $ max_ {y in Q} g (dy) $ can write
$$ max min {4y-1, 3y + 1, y + 7 } \
text {subject to:} 1 leq dy leq 10 $$

Write as a linear program:
$$ max w \
text {subject to:} w leq 4y-1 \
w leq 3y + 1 \
w leq y + 7 \
-dy leq -1 \
dy leq 10 $$

$ textbf {I don't know if I wrote correctly, did I write the constraints} $
$ textbf {$ – dy leq 1, dy leq 10 $ correctly? Are they supposed to be written in terms of w?} $

I have highlighted my concerns in bold. Additional concerns:

$ textbf {Did I correctly formulate the linear program assuming $ d in mathbb {R} $ and $ y in mathbb {R} $?} $

$ textbf {$ d $ should it actually be in $ mathbb R ^ n $ and $ y in mathbb R ^ n $, or am I right to say that these should read $ mathbb {R} $?} $

Thank you:

design – Simple Snake Game in C ++

I originally posted this question in Code Review, but I thought I could possibly get more design comments here.

I just finished writing a simple clone of Snake in C ++ in order to have a real design this time and to adhere to the solid principles of OOP. So I made a class diagram of the game and wrote all the code, and it works well, but there are areas where I feel like I could have done better . For example, there are hard-coded items that I couldn't elegantly remove, and there is a place where I use inheritance, but I also have a enumeration to determine which child a message comes from when I prefer not to have to worry about the type of child.

Anyway, here is the class diagram:

class diagram

The engine is a simple engine that I wrote to easily display 2D graphics, I only use it for rendering and some helper classes like v2di which is an integer 2D vector for storing location information


Here is the game class which is responsible for starting and running the game.

OnCreate() is called once at startup,

OnUpdate() and OnRender() are called once per image and must contain the game loop,

OnDestroy() is called when the internal game loop ends and the program is about to close:

///////////////// .h

class SnakeGame : public rge::DXGraphicsEngine {
public:
    SnakeGame();
    bool OnCreate();
    bool OnUpdate();
    bool OnRender();
    void OnDestroy();

protected:
    Snake snake;
    FieldGrid field;
    int score;
    bool gameOver;
    int updateFreq;
    int updateCounter;
};

//////////////////////// .cpp

SnakeGame::SnakeGame() : DXGraphicsEngine(), field(10, 10), snake(3, rge::v2di(3, 1), Direction::RIGHT), score(0), gameOver(false), updateFreq(10), updateCounter(0){

}

bool SnakeGame::OnCreate() {
    field.AddSnake(snake.GetBody());
    field.GenerateFood();
    return true;
}

bool SnakeGame::OnUpdate() {

    //check user input
    if(GetKey(rge::W).pressed) {
        snake.SetDirection(Direction::UP);
    }
    if(GetKey(rge::S).pressed) {
        snake.SetDirection(Direction::DOWN);
    }
    if(GetKey(rge::A).pressed) {
        snake.SetDirection(Direction::LEFT);
    }
    if(GetKey(rge::D).pressed) {
        snake.SetDirection(Direction::RIGHT);
    }

    updateCounter++;
    if(!gameOver && updateCounter >= updateFreq) {
        updateCounter = 0;
        //clear snake body from field
        field.ClearSnake(snake.GetBody());
        //move
        snake.MoveSnake();
        //add snake body to field
        field.AddSnake(snake.GetBody());
        //testcollision
        CollisionMessage cm = field.CheckCollision(snake.GetHead());
        gameOver = cm.gameOver;
        score += cm.scoreChange ? snake.GetLength() * 10 : 0;
        if(cm.tileType == TileType::Food) {
            field.GenerateFood();
            snake.ExtendSnake();
        }
    }
    return true;
}

bool SnakeGame::OnRender() {
    std::cout << score << std::endl;
    field.Draw(&m_colorBuffer, 100, 20, 10);
    snake.DrawHead(&m_colorBuffer, 100, 20, 10);
    return true;
}

Then the Snake class that moves and extends the snake. There is also an enumeration for the Direction the snake can move:

///////////// .h

enum class Direction {
    UP, DOWN, LEFT, RIGHT
};

class Snake {
public:
    Snake();
    Snake(int length, rge::v2di position, Direction direction);
    rge::v2di GetHead() { return head; }
    std::vector GetBody() { return body; }
    void MoveSnake();
    void ExtendSnake();
    Direction GetDirection() { return direction; }
    void SetDirection(Direction direction);
    int GetLength() { return body.size() + 1; }
    void DrawHead(rge::Buffer* buffer, int x, int y, int size);

protected:
    std::vector body;
    rge::v2di head;
    Direction direction;
    Direction oldDirection;
};

////////////// .cpp

Snake::Snake(): head(rge::v2di(0, 0)), direction(Direction::UP), oldDirection(Direction::UP), body(std::vector()){
    body.push_back(rge::v2di(head.x, head.y + 1));
}

Snake::Snake(int length, rge::v2di position, Direction direction) : head(position), direction(direction), oldDirection(direction), body(std::vector()) {
    for(int i = 0; i < length-1; ++i) {
        rge::v2di bodyTile;
        switch(direction) {
        case Direction::UP:{
            bodyTile.x = head.x;
            bodyTile.y = head.y + (i + 1);
            break;
        }
        case Direction::DOWN:{
            bodyTile.x = head.x;
            bodyTile.y = head.y - (i + 1);
            break;
        }
        case Direction::LEFT: {
            bodyTile.y = head.y;
            bodyTile.x = head.x + (i + 1);
            break;
        }
        case Direction::RIGHT: {
            bodyTile.y = head.y;
            bodyTile.x = head.x - (i + 1);
            break;
        }
        }
        body.push_back(bodyTile);
    }
}

void Snake::MoveSnake() {
    oldDirection = direction;
    for(int i = body.size()-1; i > 0; --i) {
        body(i) = body(i - 1);
    }
    body(0) = head;

    switch(direction) {
    case Direction::UP: {
        head.y--;
        break;
    }
    case Direction::DOWN: {
        head.y++;
        break;
    }
    case Direction::LEFT: {
        head.x--;
        break;
    }
    case Direction::RIGHT: {
        head.x++;
        break;
    }
    }
}

void Snake::ExtendSnake() {
    body.push_back(body(body.size() - 1));
}

void Snake::SetDirection(Direction direction) {
    switch(this->oldDirection) {
    case Direction::UP:
    case Direction::DOWN: {
        if(direction != Direction::UP && direction != Direction::DOWN) {
            this->direction = direction;
        }
        break;
    }
    case Direction::LEFT:
    case Direction::RIGHT: {
        if(direction != Direction::LEFT && direction != Direction::RIGHT) {
            this->direction = direction;
        }
        break;
    }
    }
}

void Snake::DrawHead(rge::Buffer* buffer, int x, int y, int size) {
    rge::Color c(100, 100, 200);
    buffer->DrawRegion(x + head.x * size, y + head.y * size, x + head.x * size + size, y + head.y * size + size, c.GetHex());
}

Then there is the FieldGrid class responsible for detecting collisions, generating food and storing map state:

//////////// .h

class FieldGrid {
public:
    FieldGrid();
    FieldGrid(int width, int height);
    ~FieldGrid();
    void GenerateFood();
    CollisionMessage CheckCollision(rge::v2di head);
    void ClearSnake(std::vector body);
    void AddSnake(std::vector body);
    void Draw(rge::Buffer* buffer, int x, int y, int size);
protected:
    std::vector> field;
    int width;
    int height;
};

//////////// .cpp

FieldGrid::FieldGrid() : width(10), height(10), field(std::vector>()) {
    for(int i = 0; i < width; ++i) {
        field.push_back(std::vector());
        for(int j = 0; j < height; ++j) {
            field(i).push_back(new EmptyTile());
        }
    }
}

FieldGrid::FieldGrid(int width, int height): width(width), height(height), field(std::vector>()) {
    for(int i = 0; i < width; ++i) {
        field.push_back(std::vector());
        for(int j = 0; j < height; ++j) {
            field(i).push_back(new EmptyTile());
        }
    }
}

FieldGrid::~FieldGrid() {
    for(int i = 0; i < field.size(); ++i) {
        for(int j = 0; j < field(i).size(); ++j) {
            delete field(i)(j);
        }
        field(i).clear();
    }
    field.clear();
}

void FieldGrid::GenerateFood() {
    int x = rand() % width;
    int y = rand() % height;
    while(!field(x)(y)->IsFree()) {
        x = rand() % width;
        y = rand() % height;
    }
    delete field(x)(y);
    field(x)(y) = new FoodTile();
}

CollisionMessage FieldGrid::CheckCollision(rge::v2di head) {
    if(head.x < 0 || head.x >= width || head.y < 0 || head.y >= height) {
        CollisionMessage cm;
        cm.scoreChange = false;
        cm.gameOver = true;
        return cm;
    }
    return field(head.x)(head.y)->OnCollide();
}

void FieldGrid::ClearSnake(std::vector body) {
    for(int i = 0; i < body.size(); ++i) {
        delete field(body(i).x)(body(i).y);
        field(body(i).x)(body(i).y) = new EmptyTile();
    }
}

void FieldGrid::AddSnake(std::vector body) {
    for(int i = 0; i < body.size(); ++i) {
        delete field(body(i).x)(body(i).y);
        field(body(i).x)(body(i).y) = new SnakeTile();
    }
}

void FieldGrid::Draw(rge::Buffer* buffer, int x, int y, int size) {
    for(int xi = 0; xi < width; ++xi) {
        for(int yi = 0; yi < height; ++yi) {
            int xp = x + xi * size;
            int yp = y + yi * size;
            field(xi)(yi)->Draw(buffer, xp, yp, size);
        }
    }
}

Tile class used in FieldGrid:

class Tile {
public:
    virtual CollisionMessage OnCollide() = 0;
    virtual bool IsFree() = 0;
    void Draw(rge::Buffer* buffer, int x, int y, int size) {
        buffer->DrawRegion(x, y, x + size, y + size, color.GetHex());
    }

protected:
    rge::Color color;
};

class EmptyTile : public Tile {
public:
    EmptyTile() {
        this->color = rge::Color(50, 50, 50);
    }

    CollisionMessage OnCollide() {
        CollisionMessage cm;
        cm.scoreChange = false;
        cm.gameOver = false;
        cm.tileType = TileType::Empty;
        return cm;
    }

    bool IsFree() { return true; }
};

class FoodTile : public Tile {
public:
    FoodTile() {
        this->color = rge::Color(50, 200, 70);
    }
    CollisionMessage OnCollide() {
        CollisionMessage cm;
        cm.scoreChange = true;
        cm.gameOver = false;
        cm.tileType = TileType::Food;
        return cm;
    }

    bool IsFree() { return false; }
};

class SnakeTile : public Tile {
public:
    SnakeTile() {
        this->color = rge::Color(120, 130, 250);
    }

    CollisionMessage OnCollide() {
        CollisionMessage cm;
        cm.scoreChange = false;
        cm.gameOver = true;
        cm.tileType = TileType::Snake;
        return cm;
    }

    bool IsFree() { return false; }
};

Finally here is the CollisionMessage class used to send messages to the game when the snake head collides with Tile:

enum class TileType {
    Empty,
    Snake,
    Food
};

class CollisionMessage {
public:
    bool scoreChange;
    bool gameOver;
    TileType tileType;
};

I have omitted all the inclusions and the main method, as they are not relevant to the design and would just take up extra space.


I appreciate the time you take to read all of my code (or just look at the class diagram) and I would really love to hear what you think of the overall design I have chosen.

json – How to build a simple jsonb object from several postgres arrays?

If I have three (or more) Postgres arrays with the same number of elements and want to create a multi-level JSONB object of it, what should I do?

Example:

create temp table tbl1 as
  select
    array('a', 'b', 'c') as keys,
    array('d', 'e', 'f') as val1,
    array('g', 'h', 'i') as val2;

Then I can do:

select jsonb_object(keys, val1) from tbl1;

And get:

{"a": "d", "b": "e", "c": "f"}

Likewise I can pass val2 and get:

select jsonb_object(keys, val2) from tbl1;
          jsonb_object          
--------------------------------
 {"a": "g", "b": "h", "c": "i"}
(1 row)

But I don't see how to get the following object:

{
  "a": { "val1": "d", "val2": "g" },
  "b": { "val1": "e", "val2": "h" },
  "c": { "val1": "f", "val2": "i" }
}

I am aware of jsonb_build_object() but that doesn't seem to be appropriate here.

How could the above result be created?

usability – User test, simple flow test

I will run a user test for a bank to assess the flow & # 39; & # 39; be our customer & # 39; & # 39 ;. This starts with collecting basic information and then connecting with a representative to finalize the request. The flow is very simple, there is only one CTA for each screen and drop-down selection and basic text fields to collect information, so I think the task completion rate, etc. is not a good criterion for focusing. I would like to study how the question logic for collecting basic information is based on the flow and how confident the user is to give information on this flow to be a customer.
What type of methods would you do?