Underline the current line in vim
Answer:
Underline the current editing line in vim is very useful, to do so, follow the guide below.
1. Press [ESC] to get into command mode
2. Enter :set cursorline
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
Underline the current line in vim
Answer:
Underline the current editing line in vim is very useful, to do so, follow the guide below.
1. Press [ESC] to get into command mode
2. Enter :set cursorline
Is PHP pass by reference or pass by value?
Answer:
PHP is pass by value, see the code below:
<?php
class Dog {
public $name;
public function __construct($name) {
$this->name = $name;
}
}
function bar($dog) {
$dog = new Dog("bar");
echo $dog->name;
}
$d = new Dog("foo");
echo $d->name;
bar($d);
echo $d->name;
If PHP is pass by reference, the last echo statement will print out "bar" instead of "foo", which is not true.
Change user's timezone setting
Answer:
User can have their own timezone setting.
1. Firstly, you need to find out the timezone string by selecting interactively using the command tzselect command.
2. Append the string to the file ~/.profile
E.g.
# echo " TZ='Asia/Hong_Kong'; export TZ" >> ~/.profile
Enable compression during scp transfer
Answer:
When you transfer files which are mainly text based using scp command, it is always good to compress them to save the bandwidth needed.
To do so:
# scp -C test.txt john@remoteserver:/home/john/
What is the difference between || and or in Perl?
Answer:
In Perl, sometimes you can use both `||` and `or` to to do the same thing. But the main different is:
Example:
open FILE, $file or die("Cannot open $file"); # Work
open FILE, $file || die("Cannot open $file"); # Does not work , because it it same as the next statement
open FILE, ($file || die("Cannot open $file")); # Obviously not work