Dealing with core Cache in Drupal 8

At this point, if you try to login in the Drupal 8 website you will be rejected, it’s because the login system doesn’t read directly the table users_field_data instead of a cache for entities is used.

To flush the cache for a specific user entity with compromise the rest of cache of your system you can use the following SQL statement.

DELETE FROM cache_entity WHERE cid = ‘values:user:1’;

Now you can grab a cup of coffee/tea and enjoy your Drupal 8 website.

Hope this will help you.

 

Vim Plugin for Drupal on Linux

Indentation

The following commands will indent your code the right amount, using spaces rather than tabs and automatically indent after you start. The commands should be added to a .vimrc file in your home directory (~/.vimrc), you may need to create this.
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent

Syntax highlighting

If you enjoy syntax highlighting, it may be worth remembering that many of Drupal’s PHP files are *.module or *.inc, among others.

Vim seems to syntax highlight *.inc files properly by default but doesn’t know that some other files are PHP content. For *.module and *.install, use this snippet in .vimrc:
if has(“autocmd”)
” Drupal *.module and *.install files.
augroup module
autocmd BufRead,BufNewFile *.module set filetype=php
autocmd BufRead,BufNewFile *.install set filetype=php
autocmd BufRead,BufNewFile *.test set filetype=php
autocmd BufRead,BufNewFile *.inc set filetype=php
autocmd BufRead,BufNewFile *.profile set filetype=php
autocmd BufRead,BufNewFile *.view set filetype=php
augroup END
endif
syntax on

more can be done its all open source.. it’s upto you 🙂

vi/vim delete commands and examples

vi delete commands – reference :-

A lot of times all people need is a quick reference, so I’ll start with a reference of vi/vim delete commands:

x delete current character
dwdelete current word
dddelete current line
5dddelete five lines

d$delete to end of line
d0delete to beginning of line

:1,.d : delete to beginning of file

:.,$d  delete to end of file

delete to end of line or beginning of line :-

To delete all the characters from your current cursor position to the beginning of the current line, use the d0 command, like this:

d0

Searching for Text Strings

Command : Action

/text : Search forward in the file for text

?text : Search backward (up) in the file for text

% : With the cursor on a parentheses, bracket, or brace character, you can press the % key to move the cursor to its matching open or close character

Insert Commands

To return to command mode from insert mode use the escape key.

Command :Action

:w : Write the file to disk

:wq : Write the file to disk and quit the editor

ZZ : Same as :wq

:w! newfile  : Write the file to a new disk file called newfile

Apache sever Configration on ubuntu

Do Change file site enable folder of etc/apache2/site-enable/
/etc/apache2/sites-enabled/000-default.conf

ServerAdmin webmaster@localhost

DocumentRoot /home/web/public_html

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ “/usr/share/doc/”

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

Edit this file :-
/etc/apache2/sites-available/*.conf
in site-available

ServerAdmin webmaster@localhost

DocumentRoot /home/web/public_html

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ “/usr/share/doc/”

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

SCREEN ON Linux

Step 1:-
Create a screen with command: screen -S

step 2:-

screen -ls

To get the screen name’s use command: screen -ls

step 3:-
Go back to screen on terminal :-
screen -r -d
where 13995 is the process ID of the screen session you wish to attach to.

Git Repo and more things to learn

Git start with some basic  to the Advanced Concepts of git :
Set your details :
git config –global user.name “John Doe”
git config –global user.email “john@example.com”

Use –global to set the configuration for all projects. If git config is used without –global and run inside a project directory, the settings are set for the specific project.

See your settings

git config –list

Initialize a git repository for existing code

cd existing-project/
git init

next add new file at your repo with following commend :
->$ git add file_name.txt

Create a branch

git checkout master
git branch new-branch-name

Here master is the starting point for the new branch. Note that with these 2 commands we don’t move to the new branch, as we are still in master and we would need to run git checkout new-branch-name. The same can be achieved using one single command: git checkout -b new-branch-name
Checkout a branch

git checkout new-branch-name

See commit history for just the current branch

git cherry -v master

(master is the branch you want to compare)
Merge branch commits

git checkout master
git merge branch-name

Here we are merging all commits of branch-name to master.
Merge a branch without committing

git merge branch-name –no-commit –no-ff

See differences between the current state and a branch

git diff branch-name

See differences in a file, between the current state and a branch

git diff branch-name path/to/file

Delete a branch

git branch -d new-branch-name

Push the new branch

git push origin new-branch-name

Get all branches

git fetch origin

Get the git root directory

git rev-parse –show-toplevel

Source: http://stackoverflow.com/q/957928/1391963
Remove from repository all locally deleted files

git rm $(git ls-files –deleted)

Source: http://stackoverflow.com/a/5147119/1391963
Delete all untracked files

git clean -f

Including directories:

git clean -f -d

Preventing sudden cardiac arrest:

git clean -n -f -d

Source: http://stackoverflow.com/q/61212/1391963
Show total file size difference between two commits

Short answer: Git does not do that.
Long answer: See http://stackoverflow.com/a/10847242/1391963
Unstage (undo add) files:

git reset HEAD file.txt

See closest tag

git describe –tags `git rev-list –tags –max-count=1`

Source. See also git-describe.
Have git pull running every X seconds, with GNU Screen

screen
for((i=1;i<=10000;i+=1)); do sleep 30 && git pull; done

Use Ctrl+a Ctrl+d to detach the screen.
See previous git commands executed

history | grep git

or

grep ‘^git’  /root/.bash_history

See recently used branches (i.e. branches ordered by most recent commit)

git for-each-ref –sort=-committerdate refs/heads/ | head

Source: http://stackoverflow.com/q/5188320/1391963

Tar project files, excluding .git directory

cd ..
tar cJf project.tar.xz project/ –exclude-vcs

Tar all locally modified files

git diff –name-only | xargs tar -cf project.tar -T –

Look for conflicts in your current files
grep -H -r “<<<” *
grep -H -r “>>>” *
grep -H -r ‘^=======$’ *

There’s also git-grep.
Apply a patch not using git:

patch < file.patch

Extract RAR files on terminal and usages

step 1: install
sudo apt-get install unrar
step 2 :create rar file
unrar e rarfilename.rar /path-to-file-for-rar/
un rar file on terminal .
unrar x filename.rar /
List (l) File Inside Rar Archive
unrar l file.rar

rar a file.rar file

deleted file form rar file as below

rar d filename.rar
set password for rar file on terminal as followed :

rar a -p tecmint.rar