Tutorial by Examples: n

If you want to show active network interfaces, type: ifconfig If you want to show also network interfaces that are down, type: ifconfig -a
You could use ethtool, but they are not going to be reboot persistent. If you want to achieve this, edit the following file: sudo vim /etc/network/interfaces And edit the file with needed informations: auto <interface_name> iface <interface_name> inet static address <ip_addres...
Using the class below, we can connect to Exchange and then set a specific user's out of office settings with UpdateUserOof: using System; using System.Web.Configuration; using Microsoft.Exchange.WebServices.Data; class ExchangeManager { private ExchangeService Service; public Exch...
x = np.random.random([100,100]) x.tofile('/path/to/dir/saved_binary.npy') y = fromfile('/path/to/dir/saved_binary.npy') z = y.reshape(100,100) all(x==z) # Output: # True
The function np.loadtxt can be used to read csv-like files: # File: # # Col_1 Col_2 # 1, 1 # 2, 4 # 3, 9 np.loadtxt('/path/to/dir/csvlike.txt', delimiter=',', comments='#') # Output: # array([[ 1., 1.], # [ 2., 4.], # [ 3., 9.]]) The same file could be read ...
When data is "tidy," it is often organized into several tables. To combine the data for analysis, we need to "update" one table with values from another. For example, we might have sales data for performances, where attributes of the performer (their budget) and of the location ...
# example data a = data.table(id = c(1L, 1L, 2L, 3L, NA_integer_), x = 11:15) # id x # 1: 1 11 # 2: 1 12 # 3: 2 13 # 4: 3 14 # 5: NA 15 b = data.table(id = 1:2, y = -(1:2)) # id y # 1: 1 -1 # 2: 2 -2 Intuition Think of x[i] as selecting a subset of x for each row of i....
# example data DT = as.data.table(mtcars, keep.rownames = TRUE) To rearrange the order of columns, use setcolorder. For example, to reverse them setcolorder(DT, rev(names(DT))) This costs almost nothing in terms of performance, since it is just permuting the list of column pointers in the da...
# example data DT = as.data.table(mtcars, keep.rownames = TRUE) To rename a column (while keeping its data the same), there is no need to copy the data to a column with a new name and delete the old one. Instead, we can use setnames(DT, "mpg_sq", "mpq_squared") to modify ...
# example data DT = data.table(iris) To modify factor levels by reference, use setattr: setattr(DT$Species, "levels", c("set", "ver", "vir") # or DT[, setattr(Species, "levels", c("set", "ver", "vir"))] The sec...
# example data set.seed(1) n = 1e7 ng = 1e4 DT = data.table( g1 = sample(ng, n, replace=TRUE), g2 = sample(ng, n, replace=TRUE), v = rnorm(n) ) Matching on one column After the first run of a subsetting operation with == or %in%... system.time( DT[ g1 %in% 1:100] )...
Tuples support the following build-in functions Comparison If elements are of the same type, python performs the comparison and returns the result. If elements are different types, it checks whether they are numbers. If numbers, perform comparison. If either element is a number, then the other...
Introduction The PHPUnit Manual describes mocking as such: The practice of replacing an object with a test double that verifies expectations, for instance asserting that a method has been called, is referred to as mocking. So instead of stubbing out code, an observer is created that not onl...
// application/controllers/Company_controller.php <?php if(!defined('BASEPATH')) exit('No direct script access allowed'); class Company_controller extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('companies_mo...
To start GDB, in the terminal, gdb <executable name> For the above example with a program named main, the command becomes gdb main Setting Breakpoints You'll probably want you program to stop at some point so that you can review the condition of your program. The line at which you wan...
Batch file command line arguments are parameter values submitted when starting the batch. They should be enclosed in quotes if they contain spaces. In a running batch file, the arguments are used for various purposes, i.e. redirection to :labels, setting variables, or running commands. The argument...
When more than 9 arguments are supplied, the shift [/n] command can be used, where /n means start at the nth argument, n is between zero and eight. Looping through arguments: :args set /a "i+=1" set arg!i!=%~1 call echo arg!i! = %%arg!i!%% shift goto :args Note, in the above exam...
Bottom sheets slide up from the bottom of the screen to reveal more content. They were added to the Android Support Library in v25.1.0 version and supports above all the versions. Make sure the following dependency is added to your app's build.gradle file under dependencies: compile 'com.android...
Assuming you have Eclipse IDE for Java Developers installed, start Eclipse, click "Help" -> "Install New Software..." Select "--All Available Sites--" at "Work with:", and navigate to "Eclipse Plugin Development Tools". Select "Eclipse Pl...
Automatic Linebreaks Table content is line wrapped automatically if it is too wide. In the following example, text is added to the second column, which causes oth the text itself and the column header of the first column to be wrapped. | this is a really wide column header | another header | | -...

Page 555 of 1088