Recognize Worthy Programming Tasks

Nowadays, IT departments have been jam-packed with a lot of nonsense and therefore a lot of Jira tickets, if you see what I mean. Here is a way to quickly assess the necessity of a task or a project to be executed. It is important to raise these questions during preliminary meetings. Once the project is launched, it will be difficult to backpedal according to my experience. Also great find in this tweet great ideas on how to tackle this question https://twitter.com/sebdedeyne/status/1271370141683638273

  • Is it going to fix something ?
  • Can we afford to break what’s already working ?
  • Do we really need to make that change ?
  • Is it going to improve performance ?

Here are the most critical questions :

  • How will this make users/customer live better ?
  • How is it going to make our developers lives better ?

Although these questions above may seem rational and logical, they can easily and will be easily swept away by some great irresponsible political bluffer developer/manager mentioning the security of a system or application. The word is dropped : Security. The winning argument, the selling point to any individual and to any of our dear IT companies, FEAR.

Although most of our infrastructure are covered with firewalls, proxies, CDN and heavy monitoring systems – I have seen Fear win the argument even if the chance of its occurring was inexistent

David Raleche

What are VI / VIM editor helper commands ?

VIM-helper

https://devhints.io/vim

https://vim.rtorr.com/

vi command description

0 move to beginning of the current line $ move to end of line H move to the top of the current window (high) M move to the middle of the current window (middle) L move to the bottom line of the current window (low) 1G move to the first line of the file 20G move to the 20th line of the file G move to the last line of the file

SAVE QUIT

:wq or :x or ZZ - write (save) and quit

GO TO LINE

:n 	Go to line n
nG 	Go to line n

COPY

yy - yank (copy) a line
2yy - yank (copy) 2 lines
yw - yank (copy) the characters of the word from the cursor position to the start of the next word
y$ - yank (copy) to end of line

Paste

p - put (paste) the clipboard after cursor
P - put (paste) before cursor

DELETE

dd - delete (cut) a line
2dd - delete (cut) 2 lines
dw - delete (cut) the characters of the word from the cursor position to the start of the next word
D - delete (cut) to the end of the line
d$ - delete (cut) to the end of the line
x - delete (cut) character

Cursor movement

h - move cursor left
j - move cursor down
k - move cursor up
l - move cursor right
H - move to top of screen
M - move to middle of screen
L - move to bottom of screen
w - jump forwards to the start of a word

Working with multiple files

:e file - edit a file in a new buffer
:bnext or :bn - go to the next buffer
:bprev or :bp - go to the previous buffer
:bd - delete a buffer (close a file)
:ls - list all open buffers
:sp file - open a file in a new buffer and split window
:vsp file - open a file in a new buffer and vertically split window
Ctrl + ws - split window
Ctrl + ww - switch windows
Ctrl + wq - quit a window
Ctrl + wv - split window vertically
Ctrl + wh - move cursor to the left window (vertical split)
Ctrl + wl - move cursor to the right window (vertical split)
Ctrl + wj - move cursor to the window below (horizontal split)
Ctrl + wk - move cursor to the window above (horizontal split)

Search and replace

/pattern - search for pattern
?pattern - search backward for pattern
\vpattern - 'very magic' pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
n - repeat search in same direction
N - repeat search in opposite direction
:%s/old/new/g - replace all old with new throughout file
:%s/old/new/gc - replace all old with new throughout file with confirmations
:noh - remove highlighting of search matches

Search in multiple files

:vimgrep /pattern/ {file} - search for pattern in multiple files

e.g.:vimgrep /foo/ */

:cn - jump to the next match
:cp - jump to the previous match
:copen - open a window containing the list of matches

Unix – Composer Issue

“continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”?

Problem

[ErrorException]                                                                          

“continue” targeting switch is equivalent to “break”. Did you mean to use “continue 2”?

SOLUTION

#1 composer self-update

#2 composer update

Easy to update Drupal 7 latest security modules

ERROR
drupal Notice: Undefined variable: not_empty_panel in include() (line 15 of /sites/all/themes/garbage/nucleus/nucleus/tpl/panel.tpl.php).

Solution

Go to settings.php

go to
yourwebsite.com/update.php

455 vim sites/default/settings.php
457 yum search gd
458 yum install php73-gd.x86_64

459 service httpd restart
460 vim sites/default/settings.php

$update_free_access = FALSE;
to
$update_free_access = TRUE;

Execute again
yourwebsite.com/update.php

Continuous Integration and Continuous Development

Fast development and Integration according to David Raleche – Process

 

 

 

QA

  • Introducing new bugs after making a change (No proper regression test)
  • Increase Automation overall
  • Lack of transparency
  • Improve quality and testability
  • No Proper Api documentation (Swagger)

Developers

  • Duplicate code throughout the program
  • Reading or writing code which is difficult to understand (PSR-2)
  • No Peer Programming (Code Review) in place (Pull Request)

 

  • CLEAN CODE

 

  • DRY do not repeat yourself
  • KISS – Keep it Stupid Simple
  • PSR-2 Code Styling
  • PSR-3 Log for debug purposes
  • PSR-4 Comment Code Properly
  • Function no exceeding 40 lines

 

  • No ERRORS

 

  • PHP Code
    • No Errors
    • No Warnings
    • No Notices
  • Unit Testing – 2 per api calls

 

  • CREATE Functional API Test

 

    • 3 positive tests
    • 3 negatives

 

 

  • Final API Documentation (swagger)

 

 

  • Check PHP logs (Nagios)
    • PHP Code
      • No Errors
      • No Warnings
      • No Notices

 

  • Execute Regression Testing

  • Make sure unit testing reach out full Code coverage