Wednesday, November 3, 2021

Install Python on M1 Mac

Install Python on M1 Mac
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/usr/local/bin/brew shellenv)"
arch -x86_64 pyenv install 2.7.18
-----------------------------------------------------------------------
Python build fails on M1 Apple Silicon with arm64 homebrew 

BUILD FAILED (OS X 11.6 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/h8/kskgcwkx4gb614nhfhhh0xgw0000gn/T/python-build.20211103220722.87338
Results logged to /var/folders/h8/kskgcwkx4gb614nhfhhh0xgw0000gn/T/python-build.20211103220722.87338.log

Solution
Type which brew in the terminal and it's shows you the location of brew! You're actually overwriting an existing install having a broken core tap.
Run these commands into your terminal

rm -fr $(brew --repo homebrew/core) # because you can't brew untap homebrew/core
brew tap homebrew/core

Thursday, September 23, 2021

brew install and brew update hang with error: 'refs/remotes/origin/master': unknown revision or path not in the working tree

error: Not a valid ref: refs/remotes/origin/master fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree.

 -----Solution------ 

rm -fr $(brew --repo homebrew/core) # because you can't `brew untap homebrew/core` 

brew tap homebrew/core

Saturday, July 17, 2021

Nicepage: Export and Update of WP Content from App

Exporting Pages and Plugin from Application

If you have changes in your Nicepage desktop projects, you can export and
import the Nicepage pages and Plugin to your existing WordPress website. 

Run the installed Nicepage application for Windows or Mac OS.

Open your working project.
Create a new page using templates or from scratch.
Click the Export button. 
In the Export Dialog, select the WordPress Tab.
Uncheck the Theme box.
Please make sure you have the "Pages and Editor Plugin" box checked.
Click the "Export" button to export the zip file with the Pages and Plugin.
Reinstalling Plugin
Open your WordPress Administration.
Deactivate and delete the previously installed Nicepage plugin, if it exists.
Your pages will not be affected by the removal of the Nicepage Plugin.
Click "Add New" to reinstall the Plugin.
Click the "Upload Plugin" button.
Browse for the zip file or drag it from the file explorer. 
Click "Install Now."
Activate the installed Plugin.
You can skip the Content import If you do not need it.

Replacing Content
You can update pages previously created in the desktop application by
exporting and replacing them on your WordPress website. All other pages will
stay unchanged. It helps if you work mainly in your desktop application, and then
move changes to your WordPress website.
While staying in the Wizard, click the "Replace previously imported content" button.
Note that you can restart the Wizard from "Nicepage -> Plugin Wizard."
When finished, open Pages.
Switch windows to compare your WordPress pages to your desktop ones.


Summary
You have learned:

How to export the Plugin and Pages from the Nicepage Desktop Application.
How to update the Nicepage WordPress Plugin and replace the WordPress Content.

 https://nicepage.com/doc/67690/export-and-update-of-wp-content-from-app

Wednesday, April 14, 2021

Create First Root User

mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'PASSWORD';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;

Thursday, March 25, 2021

Grant Single DB to MYSQL User

CREATE USER 'username'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'%';


FLUSH PRIVILEGES;

Sunday, March 21, 2021

Apache permission denied (Ubuntu)

[Mon Mar 22 06:43:51.067590 2021] [core:error] [pid 25490] (13)Permission denied: [client 27.109.115.156:55380] AH00035: access to /pssusermanipulation/ denied (filesystem path '/var/www/api/folder/folder') because search permissions are missing on a component of the path 


Solution: chmod a+rX -R /var/www

Configure Django with Apache

Python2

sudo apt-get install python-pip apache2 libapache2-mod-wsgi

Python3

sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3 

<VirtualHost *:80>

        ServerName abc.com

        ServerAlias abc.com

        Alias /static /var/www/api/env/lib/python3.6/site-packages/django/contrib/admin/static

        <Directory /var/www/api/folder/folder >

                <Files wsgi.py>

                        Require all granted

                </Files>

        </Directory>


        WSGIDaemonProcess tigergourd python-path=/var/www/folder/folder python-home=/var/www/api/env

        WSGIProcessGroup groupname

        WSGIScriptAlias / /var/www/api/folder/folder/wsgi.py


</VirtualHost>


-- In case error when run manage.py-----


mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

pip install mysql-connector-python




Running setup.py clean for Pillow

  Building wheel for pycrypto 

  

  pip uninstall pycrypto

  pip install pycryptodome


Thursday, March 18, 2021

MySQL: Necessary Command

sudo service mysql status

sudo service mysql restart

sudo mysql_secure_installation


—-- Disable root password

Sudo /etc/mysql/mysql.conf.d/mysqld.cnf

[mysqld]

skip-grant-tables


———— Setup Mysql 

sudo apt update

sudo apt install mysql-server

sudo mysql_secure_installation


--- Remove MySQL 

sudo apt purge mysql-server mysql-common

sudo apt autoremove mysql-server mysql-common


— Grant remote permission to user

GRANT ALL PRIVILEGES on *.* to root@'%' identified by ‘password’;

FLUSH PRIVILEGES;

MySQLDump


Bakup table structure and data

mysqldump -u root -p[password] [database_name] > dumpfilename.sql

Bakup table structure 

mysqldumpd -u root -p[password] [database_name] > dumpfilename.sql


 

Wednesday, March 17, 2021

Restore Digital Ocean Snapshot(Ubuntu) has an error MYSQL Service

The following packages have unmet dependencies:

 linux-image-4.4.0-177-generic : Depends: linux-modules-4.4.0-177-generic but it is not going to be installed


 mysql-client-5.7 : Depends: mysql-common (>= 5.5) but it is not going to be installed

 mysql-server-5.7 : PreDepends: mysql-common (>= 5.5) but it is not going to be installed

                    Depends: mysql-common (>= 5.6.22-1~) but it is not going to be installed

E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


1- Install header file by using this command: apt-get -f install

2- Backup MySql database

3- Remove MySql database 

4- Reinstall MySql database

5- Restore MySql database



Back Up Mysql Data When its Service Dump (Ubuntu)

 1- Backup /var/lib/mysql to other location

2- Reinstalling MySQL may solve the problem, but should only be used as a last resort! To reinstall:

sudo apt purge mysql-server mysql-common

sudo apt autoremove mysql-server mysql-common

and reinstall it again

sudo apt-get update sudo apt-get install mysql-server


3- copy backup to /var/lib/mysql 


or in case it is not override old database  please reverse backup



Create Bash Script to Check if MySQL is Running

 #!/bin/bash


# Check if MySQL is running
sudo service mysql status > /dev/null 2>&1

# Restart the MySQL service if it's not running.
if [ $? != 0 ]; then
    sudo service mysql restart
fi

Run this script every 5 minutes using a cron job like this one:

 */5 * * * * /home/user/scripts/monitor.sh > /dev/null 2>&1

Tuesday, March 16, 2021

Create Snapshot Ubuntu OS

 

Ubuntu-based Distributions

Ubuntu, Linux Mint, Elementary OS, etc.

Packages are available in the Launchpad PPA for supported Ubuntu releases. Run the following commands in a terminal window:

sudo add-apt-repository -y ppa:teejee2008/timeshift
sudo apt-get update
sudo apt-get install timeshift

https://github.com/teejee2008/timeshift

Friday, March 12, 2021

Flutter: Enable Flutter Outline view in Adroid Studio

 

  1. Android Studio > Preferences > Languages & Frameworks > Flutter > App Execution > Open Flutter Inspector view on launch.
  2. Close and Relaunch Android Studio > Open any Flutter Project > Open iOS Simulator or Android Emulator and Run Debug Mode.

Flutter: Configure Web Firebase

<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.3.0/firebase-auth.js"></script>

<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyBMrhRJqdZBjqgOMjw-2lcsiIAyA5na3VU",
authDomain: "fir-project-e1016.firebaseapp.com",
databaseURL: "https://fir-project-e1016-default-rtdb.firebaseio.com",
projectId: "fir-project-e1016",
storageBucket: "fir-project-e1016.appspot.com",
messagingSenderId: "65139327059",
appId: "1:65139327059:web:1a6472ddc7655c174d46a6",
measurementId: "G-LH4D913KNT"
};
// Initialize Firebase

firebase.initializeApp(firebaseConfig);
firebase.analytics();
firebase.firestore();
</script>

Flutter: Running with unsound null safety

 

Update pubspec.yaml

analyzer:

  enable-experiment:
- non-nullable

environment:
sdk: '>=2.12.0 <3.0.0'

Thursday, March 11, 2021

Configure Apache Virtual Host SSL & Virtual Host None SSL

 <VirtualHost *:443>

        ServerName xxx.com

        ServerAlias www.xxx.com


        DocumentRoot /var/www/xxx.com


        SSLEngine on

        SSLCertificateFile /etc/ssl/certs/xxx.crt

        SSLCertificateKeyFile /etc/ssl/private/xxx.key


    <Directory /var/www/ktechglobe.com>

        Options Indexes FollowSymLinks MultiViews

        AllowOverride All

        Require all granted

    </Directory>


        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined



</VirtualHost>


<VirtualHost *:80>


        ServerName xxx.com

        ServerAlias www.xxx.com

        #ServerAdmin webmaster@localhost

        DocumentRoot /var/www/xxx.com

        #Redirect permanent / https://www.xxx.com/

    <Directory /var/www/ktechglobe.com>

        Options Indexes FollowSymLinks MultiViews

        AllowOverride All

        Require all granted

    </Directory>



        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined


</VirtualHost>

Monday, March 8, 2021

Flutter: d8: cannot fit requested classes in a single dex file

Solution to fixed: d8-cannot-fit-requested-classes-in-a-single-dex-file 

android {

    defaultConfig {
        ...
        multiDexEnabled true
    }
    ...
}

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
}