java – Best way to use an enum to restrict value of instance field

Having an enum like this one:

public enum PersonState {
    NOT_SO_WELL (0),
    OK          (1),
    GREAT       (2);
// ... 
}

keeping in mind that the only purpose of the following Person class is to be serialized/deserialized:

public class Person {
    String name;

    // it's better to use this approach...
    int personState;

    // or this approach?
    PersonState personState;
}

what’s the best way to design the Person class?

webforms – Object reference not set to an instance of an object – Não indica mensagem de erro

O meu sistema(WEBFORMS VB.NET) tem apresentado uma exceção de objeto nula(Object reference not set to an instance of an object), que acontece apenas no servidor de produção após um período de tempo indeterminado.

Ou seja:
Após resetar o pool a aplicação volta ao normal, porém após algum tempo a exceção volta. E quando o erro acontece TODAS as páginas do projeto ficam inacessíveis, sendo necessário o reset do pool.

inserir a descrição da imagem aqui

  • O erro não produz mensagem especificando página ou linha específica
  • Já foi verificado e todas as conexões com o DB estão sendo fechadas/abertas corretamente
  • O projeto tem uma quantidade considerável de páginas, classes etc.
  • O compilador não acusa nenhuma variável ou warning referente a isso

Existe alguma forma de conseguir chegar até a raiz do erro?

amazon web services – EC2 Instance cannot connect to ECS Cluster

Helo,
I have empty AWS ECS Cluster but I am unable to put instances into it.
I wanted to use Launch templates and Autoscaling Group, but I am unable to assign created EC2 Instance.

The issue is in shown in ecs-agent.log

level=error time=2020-10-17T23:23:37Z msg="Unable to register as a container instance with ECS: RequestError: send request failedncaused by: Post "https://ecs.eu-central-1.amazonaws.com/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)" module=client.go
level=error time=2020-10-17T23:23:37Z msg="Error registering: RequestError: send request failedncaused by: Post "https://ecs.eu-central-1.amazonaws.com/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)" module=agent.go

Notes:

  • Using AMI ami-0eff571a24849e852
  • Cluster name: debug
  • Region is eu-central-1
  • Instance has no public IP
  • Instance is in 10.10.100.0/24 subnet (10.10.100.14) and VPN subnet is 10.10.0.0/16
  • Instance can reach the internet through NAT Instance:
(ec2-user@ip-10-10-100-14 ecs)$ ping google.com
PING google.com (216.58.212.142) 56(84) bytes of data.
64 bytes from ams15s21-in-f14.1e100.net (216.58.212.142): icmp_seq=1 ttl=109 time=50.1 ms
64 bytes from ams15s21-in-f142.1e100.net (216.58.212.142): icmp_seq=2 ttl=109 time=40.1 ms
  • DNS to outside is resolving fine
(ec2-user@ip-10-10-100-14 ecs)$ nslookup google.com
Server:     10.10.0.2
Address:    10.10.0.2#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.212.142
  • Just to be sure, I have created Endpoints from VPC and Subnet where Instance is to ECS
  • I have attached the security group with no restrictions for test
  • ecs.config:
ECS_CLUSTER=debug
ECS_BACKEND_HOST=
(ec2-user@ip-10-10-100-14 ecs)$ nslookup ecs.eu-central-1.amazonaws.com
Server:     10.10.0.2
Address:    10.10.0.2#53

Non-authoritative answer:
Name:   ecs.eu-central-1.amazonaws.com
Address: 10.10.100.219

Does anyone have any suggestions?

Use existing on-demand instance in a spot fleet request for Amazon

I’m trying to reduce my expenses and want to start using AWS’s spot pricing service. I’m completely new to it, but as I understand I can have instances running for certain amounts of time based on the price that will eventually stop running based on certain conditions. That’s fine, I’m also aware you can have spot fleets, and in these fleets you can have an On-Demand instance for when the spot instance is interrupted.

I currently have a an On-Demand instance that hosts an ElasticBeanStalk application (it’s an API), is there a way to use this instance inside the spot fleet so that when there’s an available spot-instance it’s servicing my EBS application then when the spot-instance is interrupted it just goes back to using my current On-Demand instance until another spot-instance is available?

Thank you in advance.

google cloud platform – GCP SLQ instance wont stop ,restart, or delete

The status says “under maintenance” and has for several hours. This is a not a large database as I am a new student with very small tables for learning. I have tried stopping and restarting as well as deleting the instance, but get an error message every time. The error simply says “The attempted action failed, please try again. Request ID: 4022803414404737811”. Operations and logs shows an “update” error “unknown error” this morning, but no other information given.

I have logged out of GCP and back in with no effect.

amazon ec2 – Is it better to have a centralized [redis] caching instance or per instance?

I have a VPC in AWS that contains a public and private subnet. In the private subnet, I have two load balanced EC2 app servers, and an EC2 Database/Cache server.

The two app servers connect to the Database/Cache server for database queries, but there is also an instance of Redis running on the database server. Both of the app servers are configured to connect to this redis instance.

My question is – is this performant? Would it be better to have an instance of Redis installed on each of the App server nodes?

Or are we better off leaving redis on the database/cache server?

innodb – What is the best configuration for a MySQL instance with a lot of databases and lot of tables?

So you have 100GB of data held in 3000 databases?

Each of those database is trivially small (I’d guess about 30MB each).

I would seriously suggest that you need to reconsider your desire to segment / segregate your data in this way. It’s almost certainly not the best way to do things.

You’re trying to run a Windows Server with only 4GB of RAM?
I’m surprised it even starts up!

OK, (just checked) Our Friends in Redmond recommend “at least 2GB” of RAM, but all that machine will be capable of doing is running the operating system itself and keeping the office a bit warmer, with its fan.

If you want to run any other software on it, then you need more memory and, with a DBMS, the more the merrier, generally speaking.

innodb – What is the best mysql configuration for mysql instance with a lot of databases and lot of tables inside?

I have a mysql database instance with more than 3000 database inside. Each database contains more than 200 tables. Total data of all theses database comes around 100gb. I am using windows server 2012R2 operating system with a 4GB of RAM. The RAM memory utilization of the server system was always showing very high. So I tried to restart the system and restart is not working. It is showing restarting for long time and not restarting. When i checked the logs I understood that there is a memory issue. What is the best configuration for the mysql with above architecture? what i need to do to make this work with out failure in future?

(Warning) InnoDB: Difficult to find free blocks in the buffer pool (1486 search iterations)! 1486 failed attempts to flush a page! Consider increasing the buffer pool size. It is also possible that in your Unix version fsync is very slow, or completely frozen inside the OS kernel. Then upgrading to a newer version of your operating system may help. Look at the number of fsyncs in diagnostic info below. Pending flushes (fsync) log: 0; buffer pool: 0. 26099 OS file reads, 1 OS file writes, 1 OS fsyncs. Starting InnoDB Monitor to print further diagnostics to the standard output.

c# – Tengo este error: “A data source instance has not been supplied for the data source “GraficaGananciasMensualesDS” “

Estoy usando un procedimiento almacenado, que solo devuelve valores, pero el reportviewer me muestra ese mensaje, y le mando el report source asi

private void ImprimirInformeMensual_Load(object sender, EventArgs e)
        {
            ReportDataSource source = new ReportDataSource("ObtenerGananciasMensualesDS");
            reportViewer1.LocalReport.DataSources.Add(source);
            this.reportViewer1.RefreshReport();
        }

Así se llama el DataSet “ObtenerGananciasMensualesDS”

Espero me ayuden

Can Reporting Services be installed on a clean remote server, then create new SSRS databases on existing SQL Instance with SSRS installed?

Can Reporting Services be installed on a clean remote server, then create new SSRS databases on existing SQL Instance with SSRS installed?

Have a SQL Instance with Reporting Services working – Lets call it “SQLinstance1”.
A new vendor/product needs its own instance of SSRS/ cannot share SSRS.

Is it possible to take a clean Windows server (no SQL installed)lets call it “Hal” , run SSRS installation ,then create ReportServer and ReportServertempdb on the SQLinstance1 (with different db names)?

Resulting in 2 separate SSRS envs:

http://Sqlinstance1/ReportServer2016
http://hal/ReportServer

If this isn’t possible what are other options other than installing using another SQL instance?

thanks