Notes

Drupal 7 - Load taxonomy tree
// Retrieve vocabulary based on its machine name
$vocabulary = taxonomy_vocabulary_machine_name_load('tags');

// Load whole taxonomies related to given vocabulary
$tree = taxonomy_get_tree($vocabulary->vid);

 

Friday, October 19, 2018 - 17:03
MySQL - CREATE DATABASE AND USER
-- Create fresh database
CREATE DATABASE drupal7_db;

-- Create a new MySQL user with specific password
CREATE USER [email protected] IDENTIFIED BY 'a2NUpXBffCYUHP6a';

-- Give full access to new MySQL user to new database just created
GRANT ALL PRIVILEGES ON drupal7_db.* TO 'drupal7_dbuser'@'localhost';

-- Rebuild privileges to make persistent those changes
FLUSH PRIVILEGES;

 

Thursday, October 11, 2018 - 20:26
PostgreSQL - Sequence Manipulation Functions
-- Retrive current sequence value
SELECT last_value FROM <sequence_name>;

-- Update sequence value
SELECT setval('sequence_name',1000);

 

Thursday, October 4, 2018 - 10:17
Drupal 7 - MySQL SELECT variable Table
-- Retrieve site name stored into variable table directly from SQL
SELECT name, CONVERT (value USING utf8) 
FROM `variable` 
WHERE name = 'site_name'

 

Wednesday, October 3, 2018 - 08:37
Update drupal/core Composer
# Verify pending updates
composer outdated drupal/*

# Update drupal core and dependencies
composer update drupal/core --with-dependencies

# Drupal site using drupal-composer/drupal-project
composer update drupal/core webflo/drupal-core-require-dev --with-dependencies

# Once I was forced to remove composer.lock and vendor/ then redo composer update with dependencies
rm -Rf composer.lock vendor/

 

Tuesday, September 4, 2018 - 14:28
Update-Database NuGet Package Manager on Azure

Firstly setup properly Azure DB firewall, then execute the following command within you Visual Studio,

 Update-Database -Configuration {Project_Namespace}.Migrations.Configuration -Verbose -ConnectionString "Server=tcp:{Azure_SQL_Server}.database.windows.net,1433;Initial Catalog={Azure_DB_Name};Persist Security Info=True;User ID={Azure_DB_Username};Password={Azure_DB_Password};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" -ConnectionProviderName "System.Data.SqlClient"

 

Sunday, July 8, 2018 - 12:59
Ifconfig inet addresses | nmap scan

ifconfig

/sbin/ifconfig | grep 'inet addr:' 

nmap

nmap -sP 192.168.1.0/24
Tuesday, May 22, 2018 - 18:02
Kill all processes on particular port
kill -9 $(lsof -t -i:4200)

 

Wednesday, May 16, 2018 - 08:37
Install your public key in a remote machine's authorized_keys
ssh-copy-id -i [email protected]_address

 

Saturday, May 12, 2018 - 15:17
Tar Linux Usage

Create compress files

tar -czvf NEW_FILE_NAME.tar.gz /PATH/TO/DIRECTORY-OR-FILE-TO-COMPRESS

Extract files

tar -xzvf FILE_NAME.tar.gz -C /tmp

 

Saturday, May 12, 2018 - 10:22