Symfony2 use a single class out of the box - MessageDigestPasswordEncoder - class

Hi everyone here is my question:
I have an external project that has to use the MessageDigestPasswordEncoder from Symfony2, here is my code. I dont get it included correctly:
require_once "../htdocs/vendor/autoload.php";
$loader->registerNamespace('Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder', '../htdocs/vendor/symfony/security/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php');
$encoder = new MessageDigestPasswordEncoder();
$password = $encoder -> encodePassword($password, '');
Here is my error message:
Warning: require_once(__DIR__/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in C:\workspace_aps\gitlist\htdocs\vendor\autoload.php on line 5
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/composer/autoload_real.php' (include_path='.') in C:\workspace_aps\gitlist\htdocs\vendor\autoload.php on line 5

This means vendor libraries are yet to install, or if already installed then you can try to update vendor libraries.
If you need to install all vendor libraries then install curl, composer.
Install curl
sudo apt-get install curl
sudo apt-get install php5-curl (this i executed after getting following exceptions)
Install Composer
curl -sS https://getcomposer.org/installer | php
Run Composer
sudo php composer.phar
This command will show all available options
Install vendor libraries
sudo php composer.phar install
(meaning of this : Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json)
If you already have every thing installed, try to update existing vendor libraries..
sudo php composer.phar update

Related

Installing Vivado ML 2021.2 in CentOs but process is hang in 'Generating installed device list'

anybody can help me figure out why the installation is hanging on 'Generating installed device list' and how to solve it without starting the process all over. I am working on CentOs.
Thanks in advance
I think this happens due to following missing packages:
libstdc++6:i386
libgtk2.0-0:i386
dpkg-dev:i386
ncurses5-compat-libs
python3-pip
libtinfo5
libncurses5
As BKN mentioned, you need to install the missing packages.
To avoid starting all over again, you can do the following:
Check the log: cat ~/.Xilinx/xinstall/*.log
Locate the error message. It should look something like:
2022-01-09 10:53:11,458 DEBUG: n.t:? - Executing script Generating installed device list: /tools/Xilinx/Vivado/2021.2/bin/vivado [-nolog, -nojournal, -mode, batch, -source, /tools/Xilinx/Vivado/2021.2/scripts/sysgen/tcl/xlpartinfo.tcl, -tclargs, /tools/Xilinx/Vivado/2021.2/data/parts/installed_devices.txt]
2022-01-09 12:05:35,319 DEBUG: n.t:? - Unable to run GenerateDevListFileLin, exit code: 130, stdout: , stderr: application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory failure msg:
application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory
2022-01-09 12:05:35,319 DEBUG: n.t:? - Executing script Generating installed device list for Model Composer: /tools/Xilinx/Vivado/2021.2/bin/vivado [-nolog, -nojournal, -mode, batch, -source, /tools/Xilinx/Model_Composer/2021.2/data/xmcGenBoardParts.tcl, -tclargs, /tools/Xilinx/Model_Composer/2021.2/../../Vivado/2021.2, librdi_dsp_tcltasks.so, /tools/Xilinx/Model_Composer/2021.2/data]
The log informs you exactly what the missing package is (in this case it was libtinfo), and also provides you with the script to run after you install the package:
/tools/Xilinx/Vivado/2021.2/bin/vivado -nolog -nojournal -mode batch -source /tools/Xilinx/Vivado/2021.2/scripts/sysgen/tcl/xlpartinfo.tcl -tclargs /tools/Xilinx/Vivado/2021.2/data/parts/installed_devices.txt
Notes:
Make sure to use the Vivado version (here it was 2021.2) and location (here it was /tools/Xilinx) according to your system.
You may need to run the script in sudo if the the permissions for writing are not available in user mode.
I also encounterd this problem on Archlinux with Vivado 2018.3.
But I just installed the library ncurses5-compat-libs, then the problem is solved.
Perhaps you can solve this by checking the library ncurses5-compat-libs.
Download the tar package instead of the self-extracting bin package
Update the java and python version
sudo apt-get install -y python3-pip
Install Dependencies
sudo apt-get install -y libstdc++6
sudo apt-get install -y libgtk2.0-0
sudo apt-get install -y dpkg-dev
NOTE: Without ibtinfo5 the application will not start and without libncurses5 the simulation will fail
`sudo apt-get install -y libtinfo5 libncurses5`
Restart the system
Untar that Vivado package
tar -xzvf Xilinx_Unified_2021.2_1021_0703.tar.gz
Locate the xsetup file in the package
Install the package in batch mode
./xsetup --agree 3rdPartyEULA,XilinxEULA --batch Install --product "Vivado" --edition "Vivado ML Enterprise" --location "/home/USER"
Once the installation has been successfully completed
Locate the settings64.sh file
./settings64.sh
Locate the cable drivers
cd Vivado/2021.2/data/xicom/cable_drivers/lin64/install_scripts/install_drivers
./install_drivers
Installing Vivado Board Files
Get the board package from the git https://github.com/Digilent/vivado-boards.git
From the vivado-board-master package copy the folder board_files undert /vivado-board-master/new/board_files
Paste the board files to Vivado/2021.2/data/boards
From the vivado-board-master package copy the file Vivado_init.tcl under /vivado-board-master/utility
Paste the file Vivado_init.tcl to the Vivado installation
That's it!! You might not need to do all these steps but that is what I ended up doing and it worked for the two machines where I installed Vivado. The installation took less than one hour.
This was originally edited into the question itself by the OP.

Magento 2 Fatal Error when running composer:install

Clone fresh Magento 2 instance;
2.Run composer:install
Fatal Error:
PHP Fatal error: Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN'
This was an issue with Composer, By installing latest version of Composer solved it.
The bug for the constant variable PRE_COMMAND_RUN is raised and closed.
You need install latest version of composer, upgrade steps given below.
-- Remove existing composer
Debian/Ubuntu
sudo apt-get remove composer
Centos/Redhat
sudo yum remove composer
Get the latest composer using wget.
cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
Move composer executable to PATH so it can be accessible globally.
sudo mv composer.phar /usr/local/bin/composer
To check the composer version
composer -V
You have to reinstall the Composer and use the latest composer version
To do that you can follow the following steps:
Step #1) Remove the current composer:
sudo apt-get remove composer
Step #2) install the composer , you can using following commands
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
then to make sure you have the latest Composer , run the following command
php composer.phar -V
Now, your ready to install Magento,
to install Magento via composer :
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition YourProjectName
if the project folder name is exist , remove the folder and try again to install magento
You probably have an outdated version that doesn't even support self-update unfortunately.
So here's a oneliner to install the latest version in /usr/local/bin:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Check:
which -a composer
/usr/local/bin/composer --version
composer --version
Composer self-update wasnt working with my composer version, I use ubuntu(LEMP).
Latest version of composer was installed - 1.6.3 I think.
We need this 1.10.17.
sudo apt remove compsoer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --version=1.10.17 --install-dir=/usr/bin --filename=composer
Check version:
composer --version
output: 1.10.17
To be sure remove all vendor and cache:
rm -rf vendor/*
composer clear-cache
composer update

Exception: Failed to attach BPF to kprobe when executing sudo opensnoop-bpfcc

When I try to execute sudo opensnoop-bpfcc I get this message:
In file included from /virtual/main.c:4:
In file included from include/linux/sched.h:14:
In file included from include/linux/pid.h:5:
In file included from include/linux/rculist.h:11:
In file included from include/linux/rcupdate.h:40:
In file included from include/linux/preempt.h:81:
In file included from ./arch/x86/include/asm/preempt.h:7:
In file included from include/linux/thread_info.h:38:
In file included from ./arch/x86/include/asm/thread_info.h:53:
./arch/x86/include/asm/cpufeature.h:150:2: warning: "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
[-W#warnings]
#warning "Compiler lacks ASM_GOTO support. Add -D __BPF_TRACING__ to your compiler arguments"
^
1 warning generated.
Traceback (most recent call last):
File "/usr/sbin/opensnoop-bpfcc", line 127, in <module>
b.attach_kprobe(event="sys_open", fn_name="trace_entry")
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 526, in attach_kprobe
raise Exception("Failed to attach BPF to kprobe")
Exception: Failed to attach BPF to kprobe
I don't understand how to fix it. I've just installed bcc tools using this command
sudo apt-get install bpfcc-tools linux-headers-$(uname -r)
as suggested on the github page https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---binary
The running OS is 18.04.2 LTS (Bionic Beaver).
I had to compile bcc from source code instead of installing it using the package.
Install linux kernel headers
sudo apt install linux-headers-$(uname -r)
Install required dependencies
sudo apt-get -y install bison build-essential cmake flex git libedit-dev \ libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev
Compile bcc from source code
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
#Maicake is right. Compiling and installing from source did work for me. Here are the steps to install on Ubuntu 22.04:
Follow the steps described here. Specifically for Ubuntu 22.04 you may need to make some changes after cloning the bcc repository.
Add the following line to your .bashrc file:
export PATH=$PATH:/usr/share/bcc/tools
Create a symlink to python3 as most of the tools use python (not python3) to run the scripts.
sudo ln -s /usr/bin/python3 /usr/bin/python

How to build and install wal2json without also installing the package postgresql-server-dev on Debian 9?

I'm trying to stream data automatically from PostgreSQL 10 to Kafka using debezium together with the logical decoding plugin, wal2json.
I followed all the instructions on how to build and install the plugin from this link by running these command lines:
$ git clone https://github.com/eulerto/wal2json.git
$ cd wal2json
$ PATH=/usr/lib/postgresql/10/bin:$PATH
$ USE_PGXS=1 make
$ USE_PGXS=1 sudo make install
Yet, the steps for installation include this command line: USE_PGXS=1 make and it requires the installation of this package
sudo apt-get install postgresql-server-dev-10
else, I get the following error
Makefile:10: /usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk: No such file or directory
make: *** No rule to make target '/usr/lib/postgresql/11/lib/pgxs/src/makefiles/pgxs.mk'. Stop.
In fact, I am not allowed to install the package postgresql-server-dev-10 for personal reasons.
Thus, is there any way to install wal2json without installing that package or without using the command make?
Thank you.

pg gem install fails, cannot find libpq-fe.h header

Whenever I run bundle install on my VPS (CentOS Linux release 7.0.1406 (Core)) I get an error when installing the pg gem.
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
I can install pg standalone with: gem install pg -- --with-pg-config=/usr/pgsql-9.4/bin/pg_config and the issue is resolved.
So I added a capistrano taskto create a ./bundle/config for the deploy with the build.pg key set with the path to pg_config on my VPS. In the Capistrano config/deploy.rb this is invoked before bundler:install.
desc "Create bundle config"
task :prepare_bundle_config do
on roles(:app) do
within release_path do
execute :bundle, 'config build.pg --with-pg-config=/usr/pgsql-9.4/bin/pg_config --local'
end
end
end
I have the necessary packages installed:
postgresql94-server.x86_64
postgresql94-devel.x86_64
postgresql94-libs.x86_64
libpqxx.x86_64
libpqxx-devel.x86_64
Here are the capistrano* gems I have installed
bundle list | grep capistrano
* capistrano (3.3.5)
* capistrano-bundler (1.1.4)
* capistrano-rails (1.1.2)
* capistrano-rbenv (2.0.3)
* capistrano-stats (1.1.1)
What am I missing here to successfully install pg with bundler? Please leave a comment if you need any additional information and I will update this post.
The postgres binaries are not in the path. Symlink them in to a directory in your path and you should be good: ln -s /usr/pgsql-9.4/bin/p* /usr/local/bin.
Did you build postgres or install it from yum?
Just posting the solution for PostgreSQL 11. If someone lands here.
sudo yum install epel-release
sudo yum install postgresql11-llvmjit
sudo yum install postgresql11-devel postgresql11-libs
Then run
gem install pg -v '1.2.3' -- --with-pg-config=/usr/pgsql-11/bin/pg_config
Thats it
I find that if I compile pgsql with source code, and PATH ENV not configed with pgsql/bin, this happends. You can have a try with this.
Alternatively, if you're using a Mac
brew link postgresql
Or in my case
brew link postgresql#12