function prepare() error en $this->Conectar() PHP y MySQL

Estoy trabajado en algunas funciones para inicios de sesión y mi clase conexión la realizo gracias al código siguiente:

 <?php
 class DB{
 private $host;
 private $db;
 private $user;
 private $password;
 private $charset;

 public function __construct()
 {
     $this->host = 'localhost';
     $this->db = 'dbname';
     $this->user = 'root';
     $this->password = '';
     $this->charset = 'utf8mb4';
 }
 public function Conectar(){
     try{
         $connection = "mysql:host=" . $this->host . ";dbname=" . $this->db . ";charset=" . $this->charset;

         $options = (PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION, 
                     PDO::ATTR_EMULATE_PREPARES => false);
         
         $pdo = new PDO($connection, $this->user, $this->password, $options);
     }catch(PDOException $e){
         print_r("Error connection: ". $e->getMessage());
     }
 }

Al crear la funcion de validación de un usuario existente tengo error en la línea $this->Conectar()

public function userExists($user, $pass){
    $md5pass = md5($pass);

    $query = $this->Conectar()->prepare('SELECT * FROM usuarios_del_sistema WHERE username = :user AND password = :pass');
    $query->execute(('user' => $user, 'pass' => $md5pass));

    if($query->rowCount()){
        return true;
    }else{
        return false;
    }
}

Mensaje de error

Fatal error: Uncaught Error: Call to a member function prepare() on null in C:xampphtdocsmyprojectlogin.php:10 Stack trace: #0 C:xampphtdocsmyprojectvalidate.php(20): User->userExists(‘prueba’, ‘prueba’) #1 {main} thrown in C:xampphtdocsmyprojectincludeslogin.php on line 10

magento2.3.5 p1 – Magento Admin Panel Error While Saving any Product at Catalog

We are getting this error while trying to save a product at Catalog > Products

“A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.”

We are running Magento ver. 2.3.5-p1

We did try:
php bin/magento indexer:reset
php bin/magento indexer:reindex
php bin/magento c:fl
php bin/magento cache:clean
php bin/magento cache:flush

Logout and Logged In again and problem still there.

Thanks,
Daniel

403-forbidden error running sharepoint online search rest api from c# console appl

I am trying to run below sharepoint online search rest api in c# console application but receiving error. the account/username i am using is already a global admin and sharepoint site collection admin and owner.
I am receiving 403 Forbidden error. Can someone suggest what permissions/authorization am i missing?

Can someone give me working example reference? i am using GET.

I am referring to example in below thread
https://stackoverflow.com/questions/59470250/i-want-to-implement-sharepoint-document-search-using-c-sharp-api

https://xxxxxx.sharepoint.com/sites/scr/_api/search/query?querytext=%27scStatusOWSCHCS=Expired%27

magento 1.9 – Fatal error: Call to a member function setData() on boolean in core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144

Good evening guys!

I am almost giving up on this error that i am getting with a new module.

Fatal error: Call to a member function setData() on boolean in /var/www/public_html/app/code/core/Mage/Adminhtml/Block/Widget/Form/Container.php on line 144

These line refers to this part:

public function getFormHtml()
{
    $this->getChild('form')->setData('action', $this->getSaveUrl());
    return $this->getChildHtml('form');
}

I have the following structure:

Company_Module_Block_Adminhtml_Campaign_Edit_Tabs > Company_Module_Block_Adminhtml_Campaign_Edit_Tab_Form > Company_Module_Block_Adminhtml_Campaign_Edit_Form

Ok i have Xdebug running on this project and everything is being called except this one :

Company_Module_Block_Adminhtml_Campaign_Edit_Form

My Edit.php is everything ok too:

    parent::__construct();
    $this->_blockGroup = 'company_module';
    $this->_controller = 'adminhtml_module';

I’ve being trying to resolve this error for days, searched every place but still with no answer 🙁

How to solve ssh error “ssh_exchange_identification: read: Connection reset by peer” on ubuntu server correctly

Related very closely to question and answers like:
How to fix “ssh_exchange_identification: read: Connection reset by peer” error?

My reputation is too low to comment or provide answer suggestion. Below is the case description and the aswer.

The error message is the the same as in above question (ssh_exchange_identification: read: Connection reset by peer), when attempting to ssh the server.

doe@server1 ~ $ ssh (MY_SERVER_IP)
ssh_exchange_identification: read: Connection reset by peer

ssh -v does not give any relevant additional information. As the error message suggests, the connection was reset, so there is no connectivity issue and the connection was established ssh service is running on the server just fine.

So, I found that the host was being added to /etc/hosts.deny. Entry was: sshd: (MY_HOST_IP). Whenever I deleted the entry row from the hosts.deny file (using different IP address on the client), I could login typically once from the originally failing host IP address. The same limitation did not apply to other IP addresses. I can login from other IP addresses as many times I like.

The server is Ubuntu 18.04.5 LTS was in a local network. Server has lot of webserver stuff and experiments. Quite often server is exposed to Internet so it has firewall to keep only selected ports open. It has also DenyHosts as well as Fail2Ban to handle the flood of unauthorized login attempts. Server was upgraded couple of days ago and this problem has started to occur after that. Anyways, supposedly the programs that prevent access are the the prime suspects. I started digging into them by the proposals at the previous question mentioned above.

DenyHosts uses hosts.deny to deny the access based on /etc/denyhosts.conf configuration file and the /var/log/auth.log log file analysis it does.

Looking into (MY_CLIENT_IP) in to the state of DenyHosts:

$ sudo grep -r "(MY_CLIENT_IP)"  /var/lib/denyhosts/
/var/lib/denyhosts/users-hosts:doe - (MY_CLIENT_IP):1:Sun Oct 25 12:16:06 2020
/var/lib/denyhosts/users-hosts:jane - (MY_CLIENT_IP):2:Tue Nov 10 18:16:20 2015
/var/lib/denyhosts/hosts-root:(MY_CLIENT_IP):0:Sun Oct 25 12:16:06 2020
/var/lib/denyhosts/hosts-restricted:(MY_CLIENT_IP):0:Sun Oct 25 12:16:06 2020
/var/lib/denyhosts/hosts:(MY_CLIENT_IP):0:Sun Oct 25 12:16:05 2020
/var/lib/denyhosts/hosts-valid:(MY_CLIENT_IP):1:Sun Oct 25 12:16:06 2020

Removing (MY_CLIENT_IP) entries gives temporary resolution because DenyHosts will put it back there after it has done it’s math on the analysis. During this troubleshooting I found also changed behaviour of fail2ban and below is the stuff related to that. Basically fail2ban also started to hate me logging in.

Fail2Ban works towards the same goal bit differently (uses IPTABLES for blocking) and also the ssh login error is different due to firewall blocking access:

doe@server1 ~ $ ssh (MY_SERVER_IP)
ssh: connect to host (MY_SERVER_IP) port 22: Connection refused

The thing is that now also fail2ban is starting to add (MY_HOST_IP) into the sshd jail it uses to block an IP. I need to run also:

$ sudo fail2ban-client set sshd unbanip (MY_CLIENT_IP)

After first removing entries from the above files/locations (after stopping the services), I also made a copy of auth.log for possible further analysis then removed auth.log and restarted server. I thought clearing the auth.log is necessary to prevent blocking from re-occurring.

$ sudo cp /var/log/auth.log auth.log.copy
$ sudo rm /var/log/auth.log
$ sudo reboot

Was this ok or what would have been the correct way of dealing with the issue? This resolved the issue, but was it a bad practise and did I misuse or fail to use the applications properties? Is there a way to make DenyHosts and Fail2Ban start reading auth.log from restart time fordward, or are those supposed to do that by default? Should I have done something else or more elegant steps to clear the situation?

PS. Yes I know, I could white-list my host, start using keys or start typing more carefully.

networking – Snap refresh is throwing network is unreachable error

While running sudo snap refresh i have started receiving network not reachable errors. While on my other machine it is working fine. I didn’t change any network settings.

sudo snap refresh
error: cannot refresh: persistent network error: Get
       https://api.snapcraft.io/api/v1/snaps/assertions/snap-declaration/16/99T7MUlRhtI3U0QFgl5mXXESAiSwt776?max-format=4:
       dial tcp 91.189.92.40:443: connect: network is unreachable

I have dual network cards on this device.

$ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:90:d4:3e brd ff:ff:ff:ff:ff:ff
    inet 192.168.100.60/24 brd 192.168.100.255 scope global ens3
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe90:d43e/64 scope link 
       valid_lft forever preferred_lft forever
3: ens7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:5c:4a:df brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.121/24 brd 192.168.0.255 scope global ens7
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe5c:4adf/64 scope link 
       valid_lft forever preferred_lft forever
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:74:7f:9b:9e brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
5: br-40837c4d82f5: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:d9:24:03:6a brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-40837c4d82f5
       valid_lft forever preferred_lft forever
6: br-a0cf55730515: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
    link/ether 02:42:ec:09:a0:03 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.1/16 brd 172.19.255.255 scope global br-a0cf55730515
       valid_lft forever preferred_lft forever
8: veth9d95ea7@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker0 state UP group default 
    link/ether 4a:b6:49:01:26:e5 brd ff:ff:ff:ff:ff:ff link-netnsid 0


has other service started interfering with snap service, I can run apt update just fine.

sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

MySQL Enterprise Monitor Installation Error: MySQL Instance

I am trying to set up MySQL Enterprise Monitor on a RHEL8 server with MySQL 8.0.22 Enterprise Edition.
I hit this error:

**Error running /opt/mysql/enterprise/monitor/mysql/bin/mysql
–defaults-file=/opt/mysql/enterprise/monitor/mysql/my.cnf -S
/opt/mysql/enterprise/monitor/mysql/tmp/mysql.sock -u root -D mysql -e “DELETE
FROM user WHERE user = ‘root’ AND host NOT IN (‘localhost’, ‘127.0.0.1’); ALTER
USER ‘root’@’localhost’ IDENTIFIED BY ‘****’; UPDATE user SET User =
‘service_manager’ WHERE User = ‘root’; DELETE FROM user WHERE User = ”; FLUSH
PRIVILEGES;”: /opt/mysql/enterprise/monitor/mysql/bin/mysql: error while loading
shared libraries: libtinfo.so.5: cannot open shared object file: No such file or
directory

Press (Enter) to continue:**

I was able to continue, but I am not able to load the MySQL Enterprise Monitor dashboard.
I have an existing instance on the server, but I chose bundled MySQL database in the installation.

How do I resolve this error?

boot – Error booting ubuntu20.04 on macbookpro

recently i heard about ubuntu 20.10 and i tried updating, as it was updating i had to force shutdown it as it became unresponsive even after wating a few hours, i try rebooting it and this shows upsomething about mok state has failed

I googled for help and saw that rEFInd may help so i give it a go and it got stuck on this screenrEFIND booting OS
Is there anything i can do?
I can boot macos but i rarely ever use it.im a Newbie at linux but the community made me switch over, so if you could, please explain the solution!