Adding temporary ip to a network card on Linux

In Linux you can achive it by using the following command

ip address add (your_ip) 192.168.168.22/24 dev eth0 (dev – device)

to make it permanent use /etc/networks/interfaces

 

 

Advertisements

Seven Layers of OSI Model in an easy way

The below is my person view. Please refer to proper books if need a deeper understanding of OSI model Layers )

You have got a

Cable – Layer 1

which you connect to network card which has got hardware specific number called

MAC – Layer 2

Network card needs an

IP – Layer 3

then you need

Port – Layer 4 (icmp,80,443)

to create a

Connection – Layer 5 (Established)

Once connection is make you can send

Data – Layer 6

and present this data to the

Application– Layer 7

Cable -> Network Card MAC -> IP->Port-> Connection – >Data Format – Application

  1. Cable – Physical Layer
  2. MAC – Data link Layer
  3. IP – Network Layer (IPv4/IPv6 , OSPF,
  4. Port – Transport Layer
  5. Connection – Session Layer
  6. Data formatting – Presentation Layer (SSL/TLS)
  7. Http – Application Layer

Chrome (Application) receive a html code (Data) from your request on port 80/443 n) using IP address (www.example.com) using netwok card which is connected by the cable to the server responding to your request.

seven-layers-of-OSI-model

Ref: https://community.fs.com/blog/tcpip-vs-osi-whats-the-difference-between-the-two-models.html

How to fix Internal Error after migrating bitnami to a new stack/version while trying to upload any file

The issue may occur if you are migration from one version to another version using default bitnami virtual image.

In the process of migration you need to copy the “files” folder to a new stack and this may overwrite permissions.

In this case in the previous version bitnami guys have used bitnami:bitnami while in the new version it has changed to bitnami:deamon and the group did not have write permission to folders hence it was displaying Internal Error while trying to upload any file.

sudo chown -R bitnami:deamon /opt/bitnami/apps/redmine/htdocs/files

sudo chmod  -R 771 n /opt/bitnami/apps/redmine/htdocs/files

How to use Editable in Yii2 on DetailView

Follow https://github.com/kartik-v/yii2-editable to get in your Yii2 project

Add on the top of your page in yii2 view.

use kartik\editable\Editable;
// create a similar in your code replace ‘name’ with you correct attribute
[
‘attribute’=>’name’,
‘format’=>’raw’,
‘value’=>Editable::widget([
‘model’=> $model,
‘attribute’=>’name’,
‘asPopover’=>true,
‘size’=>’lg’,
‘header’=>’Name’,
‘displayValueConfig’=> $model->name,
‘placement’=>’right’,
‘format’=>Editable::FORMAT_LINK,
‘inputType’=>Editable::INPUT_TEXT,
‘data’=>$model->name, // any list of values
]),
],
// in your controller for that model add the following code
// Check if there is an Editable ajax request
if (isset($_POST[‘hasEditable’])) {
// use Yii’s response format to encode output as JSON
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
// read your posted model attributes
if ($model->load($_POST)) {
$redirectFlag = false;
$output = ”;
$posted = $_POST[‘Projects’]; // <———– This is your Model NAME
if( isset($posted[‘name’]) AND!empty($posted[‘name’]) ){
$model->name = $posted[‘name’];
$redirectFlag = true; //set to true to reload the page to update non ajax content
}
if($model->save()){
if($redirectFlag){return$this->redirect([‘view’, ‘id’=> $model->project_id]);
}else{return [‘output’=>$output, ‘message’=>”]; }
}else{return [‘output’=>”, ‘message’=>’Validation error’]; }
}else {return [‘output’=>”, ‘message’=>”];}
}