Webform Computed Data Display Grade and Text based on result

I am building a quiz using webforms and the computed data twig and have a question if something is possible and if there is documentation on how to build this.

The quiz is 20 questions and each answer has a value of 1-5, I have all of the computed data working and it is able to show the final score properly, but was wonder if I could assign a grade and give short text feedback based on the score.

For example:
A user scores less than 70 they would receive a grade of “Below Average”, 70-80 Average and 81-100 “Above Average” and then some text giving them feedback on their score depending on this range they scored in. Is this possible to do in webforms?

Thank you so much for any help!

magento2.3 – Create a ResourceModel based on 3rd Party API Call from Magento

I am working on integrating a 3rd Party API into Magento. I’d like to use an Admin Grid with a Data Source that comes from a 3rd party API. So Essentially the Flow work like this…
User Loads into admin page with grid -> grid has data source specified to resource model -> resource model calls 3rd party api to get data -> data is returned to resource model(not sure if its supposed to be resource model or collection or factory in this scenario) -> data is bind through the resource model to the grid.

If there’s any additional information needed please let me know. I’m not sure what all information might be helpful.

pokemon – Way of implemented tile based movement is okay ? (Java 2D GAME)

Recent i started my fist “real” project.
My goal is to code the first gen of Pokemon in Java.
I have higly oriented my code on a YouTube viedo
(https://www.youtube.com/watch?v=dEKs-3GhVKQ&list=PLah6faXAgguMnTBs3JnEJY0shAc18XYQZ&index=1).
I have learned a lot working through the tutorial and understood everything so far.
Now i am at the point to intigrate my tile based movement, and i am really not sure if i did this the right way.
The problem is that if i render the player just by tiles (or move the player just by tiles) he is hopping from one tile to another. Its not a smoth walking animation anymore. I have solved this problem by using a timer to the pressed keys. If u press a key the key press detection is set to true for a amount of time.
The issue with this is that i cant controll the speed of my player in a nice way.
Now the question, can solve this problem in a better way maybe throug tweening ? Or is there a other way ?

I am new to game coding so any advides or help would be really kind.

Here is the whole projekt :
https://github.com/komiza24/Pokemom

In here is the timer set up for the amount of time the key is pressed : https://github.com/komiza24/Pokemom/blob/main/src/input/KeyManager.java

public class KeyManager implements KeyListener {

    private boolean() keys;
    public boolean up, down, left, right;
    private long lastTime, timer;
    private float timeToWaitUntilTick;

    public KeyManager() {
        keys = new boolean(256);
        timer = 0;
        lastTime = System.currentTimeMillis();
        timeToWaitUntilTick = 520.00f ;  
                

    }

    public void tick() {
        
        timer += System.currentTimeMillis() - lastTime;
        lastTime = System.currentTimeMillis();
        
        
         if (timer > timeToWaitUntilTick) {


         up = keys(KeyEvent.VK_W);
        down = keys(KeyEvent.VK_S);
        left = keys(KeyEvent.VK_A);
        right = keys(KeyEvent.VK_D);
        
        
       timer = 0 ;  
       
        }
        
    
    }

    @Override
    public void keyPressed(KeyEvent e) {
        keys(e.getKeyCode()) = true;
    }

    @Override
    public void keyReleased(KeyEvent e) {
        keys(e.getKeyCode()) = false;
    }

In here is the creature speed set :
https://github.com/komiza24/Pokemom/blob/main/src/entities/creatures/Creatures.java

public abstract class Creatures extends Entity {

    public static final int DEFAULT_HEALTH = 10;
  //  public static final float DEFAULT_SPPED = 0.125f;   // größe des Spieler damit er sich nur in Tiles bewegt (1 tile ist eig 8x8 aber spieler 16x16 )  WER FÜR TILEBASIERTES MOVEMENT
    public static final float DEFAULT_SPPED = 2 ;
    public static final int DEFAULT_CREATURE_WIDTH = 64,
            DEFAULT_CREATURE_HEIGHT = 64;
    protected int health;
    protected float speed;
    protected float xMove, yMove;

    public Creatures(Handler handler, float x, float y, int width, int height) {
        super(handler, x, y, width, height);
        health = DEFAULT_HEALTH;
        speed = DEFAULT_SPPED;
        xMove = 0;
        yMove = 0;
    }

    public void move() {
        if (!checkEntitiyCollision(xMove, 0f)) 
        moveX();

         if (!checkEntitiyCollision(0f, yMove)) 
        moveY();

    }

    public void moveX() {

        if (xMove > 0) {  //right

            int tx = (int) (x /** Tile.TILEWIDTH*/ + xMove + bounds.x + bounds.width) / Tile.TILEWIDTH;

            if (!collisionWithTile(tx, (int) (y /** Tile.TILEHEIGHT */+ bounds.y) / Tile.TILEHEIGHT)
                    && // oben rechts
                    !collisionWithTile(tx, (int) (y /** Tile.TILEHEIGHT*/ + bounds.y - 1 + bounds.height) / Tile.TILEHEIGHT)) {  // unten rechts
                x += xMove;
            }

        } else if (xMove < 0) { // left

            int tx = (int) (x /** Tile.TILEWIDTH*/ + xMove + bounds.x) / Tile.TILEWIDTH;

            if (!collisionWithTile(tx, (int) (y /** Tile.TILEHEIGHT*/ + bounds.y) / Tile.TILEHEIGHT)
                    && // oben links
                    !collisionWithTile(tx, (int) (y /** Tile.TILEHEIGHT*/ + bounds.y - 1 + bounds.height) / Tile.TILEHEIGHT)) {  // unten links
                x += xMove;
            }

        }

    }

    public void moveY() {

        if (yMove < 0) {//up

            int ty = (int) (y /** Tile.TILEHEIGHT*/ + yMove + bounds.y) / Tile.TILEHEIGHT;

            if (!collisionWithTile((int) (x /** Tile.TILEWIDTH */+ bounds.x) / Tile.TILEWIDTH, ty)
                    &&// oben links
                    !collisionWithTile((int) (x /** Tile.TILEWIDTH*/ + bounds.x - 1 + bounds.width) / Tile.TILEWIDTH, ty)) {   // oben rechts
                y += yMove;

            }

        } else if (yMove > 0) { //down

            int ty = (int) (y /** Tile.TILEHEIGHT*/ + yMove + bounds.y + bounds.height) / Tile.TILEHEIGHT;

            if (!collisionWithTile((int) (x /** Tile.TILEWIDTH*/ + bounds.x) / Tile.TILEWIDTH, ty)
                    &&// oben links
                    !collisionWithTile((int) (x /** Tile.TILEWIDTH*/ + bounds.x - 1 + bounds.width) / Tile.TILEWIDTH, ty)) {   // oben rechts
                y += yMove;

            }

        }

    }

    protected boolean collisionWithTile(int x, int y) {

        return handler.getWorld().getTile(x, y).isSolid();
    }

    public int getHealth() {
        return health;
    }

    public float getSpeed() {
        return speed;
    }

    public void setHealth(int health) {
        this.health = health;
    }

    public void setSpeed(float speed) {
        this.speed = speed;
    }

    public void setxMove(float xMove) {
        this.xMove = xMove;
    }

    public void setyMove(float yMove) {
        this.yMove = yMove;
    }

    public float getxMove() {
        return xMove;
    }

    public float getyMove() {
        return yMove;
    }

}

And finally in here the player is beeing moved :
https://github.com/komiza24/Pokemom/blob/main/src/entities/creatures/Player.java

public class Player extends Creatures {

    //animations
    private Animation animDown, animUp, animRight, animLeft;
    private int direktion;

    public Player(Handler handler, float x, float y) {
        super(handler, x, y, Creatures.DEFAULT_CREATURE_WIDTH, Creatures.DEFAULT_CREATURE_HEIGHT);
        
      
        

        // animations                       Time to wait = time to wait until get next input my keymanager so läuft die animation genau 1 mal pro Tile(Feld 16x16 micht 8x8 ! )
        animDown = new Animation(175, Assets.player_down);
        animUp = new Animation(175, Assets.player_up);
        animRight = new Animation(175, Assets.player_right);
        animLeft = new Animation(175, Assets.player_left);

    }

    @Override
    public void tick() {

        //animations
        animRight.tick();
        animLeft.tick();
        animDown.tick();
        animUp.tick();

        getInput();

        //movement
        move();

        handler.getGameCamera().centerOnEntity(this);
    }

    private void getInput() {
        xMove = 0;
        yMove = 0;

        if (handler.getKeyManager().up && !handler.getKeyManager().down && !handler.getKeyManager().left && !handler.getKeyManager().right) {

            yMove = -speed;
            direktion = 1;
        }
        if (handler.getKeyManager().down && !handler.getKeyManager().up && !handler.getKeyManager().left && !handler.getKeyManager().right) {
            yMove = +speed;
            direktion = 4;
        }
        if (handler.getKeyManager().left && !handler.getKeyManager().right && !handler.getKeyManager().down && !handler.getKeyManager().up) {

            xMove = -speed;
            direktion = 3;

        }
        if (handler.getKeyManager().right && !handler.getKeyManager().left && !handler.getKeyManager().down && !handler.getKeyManager().up) {

            xMove = +speed;
            direktion = 2;

        }

    }

    @Override
    public void render(Graphics g) {

        g.drawImage(getCurrentAnimationFrame(), (int) (x - handler.getGameCamera().getxOffset()), (int) (y  - handler.getGameCamera().getyOffset()), width, height, null);
        
        
        // HitBox Rectagle  :D 
        
        
        g.setColor(Color.RED);
        g.fillRect((int) (x + bounds.x - handler.getGameCamera().getxOffset()),
                (int) (y  + bounds.y - handler.getGameCamera().getyOffset()),
                bounds.width, bounds.height);
            
    }

    private BufferedImage getCurrentAnimationFrame() {

        if (xMove < 0) {
            return animLeft.getCurrentFrame();
        } else if (xMove > 0) {
            return animRight.getCurrentFrame();
        } else if (yMove < 0) {
            return animUp.getCurrentFrame();
        } else if (yMove > 0) {
            return animDown.getCurrentFrame();
        } else {

            
            
            
            
           
            switch (direktion) {
                case 1:
                    return Assets.player_default_up;
                case 2:
                    return Assets.player_default_right;
                case 3:
                    return Assets.player_default_left;
                default:
                    return Assets.player_default_down;
            }
           
        }

    }

}

sharepoint online – SPO: Using JSON to Show/Hide Modern Form Field Based on Value Selected in Lookup Column

I am trying to modify the new-entry form of a modern list in SharePoint Online by hiding or showing a field based on the value selected in a preceding field on the same form. Microsoft offers straightforward guidance on how to do this using a JSON snippet.

While they don’t list a lookup column as an unsupported field type to use for this purpose, they don’t provide guidance on how to use one in this way, either. And from my testing, you can’t simply grab the value of a lookup field in the described way:

=if(($LookupField)=='Hourly', 'true', 'false')

If I use a choice field instead of a lookup field, this works fine. But doing some digging, in other contexts it looks like the value may be captured in a .lookupValue property, so I tried it this way:

=if(($LookupField.lookupValue)=='Hourly', 'true', 'false')

Still no luck. Does anyone know if it is possible to use the value from a lookup field in this way? And if so, what do I need to do to make the magic happen?

Does designing an automatic interaction based on user intent a good thing?

We have this flow in our interface where user can unlink their accounts that are connected to the application. We have a button to unlink their bank, but we also have an option where user can manually unlink each account. The process here is quite tricky because they need to click the “submit” button once they are okay with their changes, reason being they need to enter 2FA,and we do not want them to enter 2FA for each change or unlink that they do for each account if needed. Sorry for the bad sketch but this is how it is currently laid out:
enter image description here

In cases that user tries to manually unlink each account and does not use the “unlink bank” option, the suggested interaction is when user clicks the last account with the “Unlink”, the system will detect their intent to unlink all accounts and the bank and will show a confirmation dialog if they want to unlink the bank:
enter image description here

It is a good interaction as it detects the intent of the user and it removes one step which is clicking the “update” button, however my concern is that clicking on the last “unlink” button and then showing a confirmation dialog after might be something unexpected? I’m not sure if the modal interrupts the user work flow since it is detecting that it wants to unlink all accounts which equals to unlinking the bank and one less click of clicking the update button, while the modal offers a second chance whether to cancel or not. Is there an article that would suggest this is a bad idea?

We cannot do user testing at the moment that is why this is challenging. But I’d like to get your thoughts or if you have any articles you could share that relates to this topic, that would be really helpful.

seo – Are there specific advantages or disadvantages of an XML sitemap over a TXT based sitemap?

Are there any specific advantages or disadvantages in generating an XML based sitemap in place of a simple txt based sitemap (list of URLs)?

I realize that in the XML format I can set priority and last-modified date, but it is not clear what benefit, if any, in terms of SEO, etc, this provides. (For instance, what benefit would there be to setting a low priority, other than possible reducing robot crawl load?) Explicitly stating this information also increases the probability of a mistake — some modification date not getting updated correctly, etc.

How to join public group in Telegram group based on an invite code

Someone provide this: tg://join?invite=xxxxxxxx
(UIApplication sharedApplication) openURL:(NSURL URLWithString:@"tg://join?invite=xxxxxxxx") options:@{} completionHandler:^(BOOL success) {});

  1. if the xxxxxxx is private invite code, it worked.
  2. if the xxxxxxx is public invite code, the telegram show "This invite link has expired"
    What do I do?

How to aggregate values from fields in Paragraphs based on value of another field in that same paragraph, and display in an aggregated Views table?

Hopefully my title makes sense…

I am setting up a Drupal 9 website for internal use as a financial reporting engine and a CRM. I am making use of the following modules:

  • Paragraphs
  • Views
  • Viewfield
  • View Fields View
  • Views Aggregator Plus

I have one Paragraph (Entity Reference) unlimited-value field on a paragraph type called “Project”. That field is called “Transactions”. It refers to a paragraph type called “Transaction”.

The “Transaction” paragraph type has the following fields:

  • Transaction Amount (decimal field))
  • Status (term reference field. Values are PAID and UNPAID)
  • Paid On (date field)
  • Year (a taxonomy entity reference field that contains pre-set years (2019, 2020, 2021, etc).

I have a content type called “Company”. It has the following fields:

  • Title
  • Project (a Paragraph/Entity Reference field)
  • Transaction Amount – Paid (a Viewfield)
  • Transaction Amount – Unpaid (a Viewfield)
    • These two Viewfields are of content type “Company”
      • One is filtered to the Transaction paragraph’s status “Paid”; the other is filtered to “Unpaid”.
    • They contain this field, which is SUMmed through Views Aggregation: (field_transactions: Paragraph) SUM(Paragraph: Transaction Amount)
    • They contain these relationships:
    field_projects_paragraph: Paragraph
    (field_projects_paragraph: Paragraph) field_transactions: Paragraph
    (field_projects_paragraph: Paragraph) field_transactions




    

The output displays the sum of the paid or unpaid transactions. For example, if a company has a project which has 3 PAID transactions of $100 each, this view will output “$300”. The intent is to display this value on the “Overview of Transactions” view, as described below:

Overview of Transactions view…

I have created a View of “Company” content of display format: “Table with Aggregation Options” that will display a table of the following columns:

  • Company Title
  • Total Transaction Amount (a SUM aggregation of all transaction “Transaction Amount” values.
  • Total Transaction Amount with status = PAID
  • Total Transaction Amount with status = UNPAID

The intent is to display an at-a-glance table of all Companies on the site, showing a line for each Company, that Company’s Total Transaction amount (which includes paid and unpaid), that company’s PAID total amount, and that company’s UNPAID total amount.

Further, the intent is to be able to filter this table based on the “Year” taxonomy term value from the Transaction paragraph type (filter it to only contain data that is tagged with “2020”, for example), or to filter it by date range using the “Paid On” value from the Transaction paragraph type (filter it to only contain data that contains a date value of 01/01/2020 – 01/03/2020, for example). The purpose is to be able to see all dollar amounts per company on a yearly, monthly, weekly, daily, or any other date range basis. For example: “display all company transaction data for Jan 1, 2020 through March 31, 20020, and then run that same report for that same time period in 2021.

To the View, I added the following settings:

Relationships:

    - field_projects_paragraph: Paragraph
    - (field_projects_paragraph: Paragraph) field_transactions: Paragraph

Filter Criteria:

    Content: Content type (= Company)
    (field_transactions: Paragraph) Paragraph: Year (exposed)
    (field_transactions: Paragraph) Paragraph: Paid On (exposed)

Fields:

    Content: ID (ID) (hidden)
    (field_transactions: Paragraph) Paragraph: ID (ID) (hidden)
    Content: Title (Title)
    (field_transactions: Paragraph) SUM(Paragraph: Transaction Amount) (Transaction Amount)
    Content: Transaction Amount - Paid (Transaction Amount - Paid) - This is one of the Views Field View fields from the Company content type
    Content: Transaction Amount - Unpaid (Transaction Amount - Unpaid) - This is one of the Views Field View fields from the Company content type

Format:Table with aggregation options

        ID: Apply Group Function: Group and Compress
        (field_transactions: Paragraph) Transaction Amount: Column Aggregation: Sum

    

My current end result is as follows:

  • Each Company has its only single line in the table.
  • The “Total
    Transaction Amount” field correctly sums the company’s total
    transactions (paid and unpaid), and the column successfully
    aggregated the total transactions of all Companies on the site.
  • The
    “Content: Transaction Amount – Paid (Transaction Amount – Paid)”
    field correctly displays the company’s total PAID transactions, but
    it does not adhere to the Year and Paid On filters. Additionally, the
    column will not SUM with the Table Aggregation settings at all.
  • The
    “Content: Transaction Amount – Unpaid (Transaction Amount – Paid)”
    field correctly displays the company’s total UNPAID transactions, but
    it does not adhere to the Year and Paid On filters. Additionally, the
    column will not SUM with the Table Aggregation settings at all.

How can I display each company’s Paid and Unpaid transaction totals in this Views aggregated table, and also make those two values subject to the Year and Paid On filters?

I am open to completely re-thinking the organization of the node types, data, etc.

REST API is protected by HMAC based authentication. What does including URL path in the message protect from?

I have came across a REST API for some commercial software, that checks authentication by requiring HMAC on concatenation of

  • http_method (GET, PUT, etc)
  • timestamp
  • payload (body of a POST / PUT request if any)
  • path (everything between https://domain.tld and the first question mark)

This HMAC then is passed in a request header.

What does this scheme protect against by including the path?

translation – Change ONLY Site Language based on Browser Language and NOT the Posts/Pages

I have a WordPress page with a custom theme translated into 3 languages using load_theme_textdomain.
I can change the site language by going to settings > site language and the theme strings change accordingly.

Now i want the site language to automatically adapt to a visitors browser-language but I am NOT interested in translating the site’s content (posts, pages) into other languages, ONLY site language (textdomain).

Been looking for hours for some way, plugin or not, but it seems to be rare case.

Does anyone know how to go about this?