How to correctly implement Java animations?

Here is what I have until now.

// In the animation class
public void update () {
timer + = System.currentTimeMillis () - lastTime;
lastTime = System.currentTimeMillis ();

if (timer> speed) {
Play = true;
index ++;

timer = 0;
if (index> = frames.length) {
index = 0;
Play = false;
}
}

} // Getters and low setters

In the main state

                @Override
public void update () {
Ability.update ();
if (AttackP.isPlaying ()) {
AttackP.update ();

}

// gets
Checkup();
getMousePosition ();
}

                if (turn == true) {// Only executes when players turn
if (MousePressed &&! AttackP.isPlaying () &&! AttackingP) {
// if we click on it when the animations are not read and when AttackingP is false
buttonCheck (g); // following
} else if (! MousePressed) {// set the attack to false when the mouse is not depressed
AttackingP = false;
}

private cancel button (Graphics g) {
if (MouseX<501&&MouseX>420 && MouseY<531&&MouseY>500) {// if the mouse is in this button

AttackingP = true;
StartAnimation (g);

}

                private cancellation StartAnimation (Graphics g) {

g.drawImage (getCurrentAnimationFrame (), 175.0 512/2 512/2, null); // reading the animation
BossHealth- = 5;
turn = false;

}

public BufferedImage getCurrentAnimationFrame () {
return AttackP.getCurrentFrame ();
}

The problem is that when I press the button, the animation only renders one image, not the others of the BufferedImage array.

Help appreciated, I am stuck on this part for 2 days now.

html – Should HTML5 browsers handle HTML4 tags correctly when they appear in HTML5 pages?

According to the article published here, the HTML5 specification requires HTML5 browsers to be able to correctly process HTML4 tags when they appear in HTML5 pages.

Unfortunately, the publication does not corroborate this statement very well. Can any one answer this question on StackExchange, and if the answer is "yes," can he also justify his claim by referring to specific sections of the HTML5 specification in a precise way?

seo – Why is the meta-description not showing up correctly on Google?

Bizarre divergence in the meta description. On the source code of the website, the meta-description is "Insurance brokers provide insurance to movies, photographers, events, theater producers, music performers and others"

At the moment, on Google SERP, the meta-description is as follows: "Insurance brokers provide insurance to movies, photographers, events, … theater companies and photographers with offices in: Vancouver, Toronto, …"

this strange ", …" after "Events" mystifies me. Any ideas on how to solve this problem, whoever?

the resolution of the screen on the desktop is not aligned correctly

Of the many resolutions available in Ubuntu, I chose a resolution in the settings, but this particular resolution is not perfectly aligned on my screen.
The display on the monitor is moved to the left and hides something in the left.
This brings a black part in the right side. What is the solution to remedy this?

I'm using ubuntu 18.04.2 bionic beaver. But other resolutions are aligned to perfectly monitor the screen.

postgresql – How to correctly model the parent-child relationship in a Postgres multi-tenant, multi-schema database

I have a SaaS application for multiple tenants, where each tenant gets his own scheme. When a user creates an account, I create a new schema and run a set of migrations to create tables under that schema. Then, when the user wants to authenticate, he provides information about his client (he can act from his subdomain, for example, mycompany.coolapp.com or from a Unique account ID), and the application routes the following requests to the schema of this client.

However, some tenant data will be public. For example, the user will need to create invoices and e-mail their links (containing a UUID) to their customers. When the customer clicks on the link, the application must be able to determine which tenant belongs the invoice, according to the UUID.

To do this, I created a table "public.invoices", with two columns: uuid and tenant. The latter contains the tenant's schema name, which I can then use to perform the following queries (that is, the actual invoice data) on the appropriate schema.

Question 1: Is this design sound? Is there another, more standard way to route unauthenticated / pre-authenticated requests to specific schemas in situations where each tenant gets its own schema?

Question 2: How can I tell Postgres that when the renter deletes the invoice (that of his schema), the public record (under "public.invoices") must also be deleted? I try to avoid using two queries, if an option or feature provided by the database exists. I've reviewed CASCADE, but it seems like it's only about parents and, as far as I know, there's no way to define a foreign key relationship in this scenario where the tenant's bill is the parent record.

magento2.3.1 – How to correctly create Magento Catalog Api Data ProductAttributeMediaGalleryEntryInterface without Object Manager?

I can not find the factory for this data object. I do not see it in the generated folder, nor do I see references online. What is the best way to create this in my module? in addition to using objectManager.

Magento Catalog Api Data ProductAttributeMediaGalleryEntryInterface

object-oriented – implement PHP OOP correctly in Post Class blog

I would like to know the best way to configure my PHP blog lessons.

I have created a Post class that creates a blog post.

post class
{

private title;
private body;
private $ createdDate;
private $ publishedDate = null;
private $ published = false;

public function __construct (string $ title, string $ body)
{
$ this-> setTitle ($ title);
$ this-> setBody ($ body);
$ this-> createdDate = date (d / M / Y / & 39;);
}

public function publish ()
{
$ this-> published = true;
$ this-> publishedDate = date (d / M / Y / & 39;);
}

public service unpublish ()
{
$ this-> published = false;
$ this-> publishedDate = null;
}

public function setTitle (string $ title)
{
$ this-> title = $ title;
}

public function getTitle (): string
{
returns $ this-> title;
}

public function setBody (string $ body)
{
$ this-> body = $ body;
}

public function getBody (): string
{
returns $ this-> body;
}

}

I also have a simple database course

Database class
{

private $ db;

public function __construct ($ host, $ name, $ username, $ password)
{
$ dsn = "mysql: host = $ host; dbname = $ name";
try {
$ this-> db = new PDO ($ dsn, $ username, $ password);
} catch (PDOException $ e) {
die (& # 39; Error: & # 39 ;. $ e-> getMessage ());
}
}
}

My question is: where should the database class be extended? I could use it in my Post course, but it would not really make sense to make Post queries related to this particular blog post. It would also be foolish to execute a query to get all items only from that object. The SOLID principle states that a class should have only one responsibility. Therefore, I am concerned that creating an object for publishing and executing multiple queries within the class does give it many responsibilities.

I've read articles on static methods where they might be useful because I could run a query on a Post object, which would not need to be instantiated. However, I read that static methods should be avoided for various reasons, such as breaking encapsulation.

I've looked for examples online, but they do not seem to be fully implementing the OOP. All Pure OOP examples you know would be interesting to hear.

C # How does it work correctly with ProgressBar? Architectural look

I have a confusion about the correct work of architecture with the progress bar in C #, but maybe that's not just for C # because I've need the architecture to look for that.

I explain my question on the example. The user presses a button and then program starts working on a huge algorithm and part of the algorithm takes too much time. This part is very low, far from user interface projects and user interface classes. I would like to show the progress bar for the user to see the progress of this algorithm.

What is the best way? Is it possible to connect the view (reference) of the progress bar on this project, where is the algorithm at the lower level? Or is it better to create a view of the progress bar in the existing UI project and send information about the state of the algorithm at all levels (from the algorithm at the user interface)? Or is there another better way?

I think the second way is better but it will be harder to implement.

Thanks for all the answers, but I prefer the response of software architects.

python – In queries, how to correctly read ISO-8859-1 encoding?

In Python3, with beautifulsoup4 and its queries, I want to extract information from a site on which the encoding is "ISO-8859-1". I have tried this strategy to correctly display the text:

import requests
from bs4 import BeautifulSoup

req = requests.get (https: //sisgvarmazenamento.blob.core.windows.net/prd/PublicacaoPortal/Arquivos/201901.htm&#39;)
req.encodage

encoding = req.encoding
text = req.content

decoded_text = text.decode (encoding)

soup = BeautifulSoup (decoded_text, "lxml")

soup.find ("h1")

And the result that appears is:

MUNICIPAL ROOM OF SÃO PAULO

When I copy and paste this screen looks ok, but on my computer all the focus is wrong

I'm on a machine with Ubuntu

Please, does anyone know a correct way to read the encoding?

reactjs – React-Router does not render stylized component styles correctly

The problem is that when I navigate to a "Posted" screen and then use my browser to go back, the CSS styles are not displayed, but the styles of the expanded view, rather than those of the type " undeveloped". & # 39; view. If I change a style on the component with the help of Inspect Element, the problem is solved immediately. I know I could probably work around this problem by adding a back button on the page, which I will probably do, but what about people who use the browser's Back button?

I'm trying to use the same StyledComponent for different pages. Here is the code for my router


          posts.map ((post, key) => )}
/>
       renderCurrentPost (currentPath)}
/>
    

All that the second route does is find the right post to render, then return it.

Here is my code for the specific styled component.

import Styled from & # 39; styled-components & # 39 ;;
const Title = Styled.h1`
@import url (https: //fonts.googleapis.com/css? family = Roboto & display = swap & # 39;);
font family: "Roboto", sans-serif;
font style: medium;
color: $ {props => (props.expanded? `white`:` # 111111`)}
font size: $ {props => (props.expanded? `5vh`:` 1.2em`)}
margin: 0 0 0 0;
align-self: flexible end;
/ * display: inline; * /
position: $ {props => (props.expanded? `relative`:` `)};
top: $ {props => (props.expanded? `70%`: ``)};
left: $ {props => (props.expanded? `5%`: ``)};
`;

export title by default;

I use the accessories extensively in these components because it will change the way it is rendered.

Here is the desired style that displays correctly when you first access the landing page.Desired style

Here is the unwanted style that occurs when you return from an extended publishing page with the help of the browser's back button.Style without desire