Tutorial by Examples: c

To show all staged and unstaged changes, use: git diff HEAD NOTE: You can also use the following command: git status -vv The difference being that the output of the latter will actually tell you which changes are staged for commit and which are not.
Sometimes you may want to start a new activity while removing previous activities from the back stack, so the back button doesn't take you back to them. One example of this might be starting an app on the Login activity, taking you through to the Main activity of your application, but on logging out...
The built-in mtcars data frame contains information about 32 cars, including their weight, fuel efficiency (in miles-per-gallon), speed, etc. (To find out more about the dataset, use help(mtcars)). If we are interested in the relationship between fuel efficiency (mpg) and weight (wt) we may start p...
apply is used to evaluate a function (maybe an anonymous one) over the margins of an array or matrix. Let's use the iris dataset to illustrate this idea. The iris dataset has measurements of 150 flowers from 3 species. Let's see how this dataset is structured: > head(iris) Sepal.Length Sep...
A table can be replicated as follows: CREATE TABLE ClonedPersons LIKE Persons; The new table will have exactly the same structure as the original table, including indexes and column attributes. As well as manually creating a table, it is also possible to create table by selecting data from anot...
The <!DOCTYPE> declaration should always be included at the top of the HTML document, before the <html> tag. 5 See HTML 5 Doctype for details on the HTML 5 Doctype. <!DOCTYPE html> 4.01 See HTML 4.01 Doctypes for details on how these types differ from each other. Stri...
First we need to install composer. Steps to install composer Install Composer. curl -sS https://getcomposer.org/installer | php Now change directory: sudo mv composer.phar /usr/local/bin/composer Check composer working composer Now Composer installed. There two ways to install Yii2 adv...
Introduction Interfaces are definitions of the public APIs classes must implement to satisfy the interface. They work as "contracts", specifying what a set of subclasses does, but not how they do it. Interface definition is much alike class definition, changing the keyword class to inter...
Default behaviour is when the merge resolves as a fast-forward, only update the branch pointer, without creating a merge commit. Use --no-ff to resolve. git merge <branch_name> --no-ff -m "<commit message>"
In Python 2, print is a statement: Python 2.x2.7 print "Hello World" print # print a newline print "No newline", # add trailing comma to remove newline print >>sys.stderr, "Error" # print to stderr print("hello"...
Code first allows you to create your entities (classes) without using a GUI designer or a .edmx file. It is named Code first, because you can create your models first and Entity framework will create database according to mappings for you automatically. Or you can also use this approach with existin...
Functions can take inputs in form of variables that can be used and assigned inside their own scope. The following function takes two numeric values and returns their sum: function addition (argument1, argument2){ return argument1 + argument2; } console.log(addition(2, 3)); // -> 5 ...
x = [5, 5, 1, 3] y = [5, 2, 4, 3] Union (|) contains elements from both arrays, with duplicates removed: x | y => [5, 1, 3, 2, 4] Intersection (&) contains elements which are present both in first and second array: x & y => [5, 3] Difference (-) contains elements which ar...
If a selection on multiple arguments for a type generic expression is wanted, and all types in question are arithmetic types, an easy way to avoid nested _Generic expressions is to use addition of the parameters in the controlling expression: int max_int(int, int); unsigned max_unsigned(unsigned, ...
The FOR XML PATH can be used for concatenating values into string. The example below concatenates values into a CSV string: DECLARE @DataSource TABLE ( [rowID] TINYINT ,[FirstName] NVARCHAR(32) ); INSERT INTO @DataSource ([rowID], [FirstName]) VALUES (1, 'Alex') ,(2, 'Peter') ...
The easiest way to set up NumPy on Mac is with pip pip install numpy Installation using Conda. Conda available for Windows, Mac, and Linux Install Conda. There are two ways to install Conda, either with Anaconda (Full package, include numpy) or Miniconda (only Conda,Python, and the package...
Callables are anything which can be called as a callback. Things that can be termed a "callback" are as follows: Anonymous functions Standard PHP functions (note: not language constructs) Static Classes non-static Classes (using an alternate syntax) Specific Object...
Python 2.x2.7 In Python 2 there are two variants of string: those made of bytes with type (str) and those made of text with type (unicode). In Python 2, an object of type str is always a byte sequence, but is commonly used for both text and binary data. A string literal is interpreted as a byte s...
While using scaffolding is a fast and easy if you are new to Rails or you are creating a new application, later it can be useful just to do it on your own ato avoid the need to go through the scaffold-generated code to slim it down (remove unused parts, etc.). Creating a model can be as simple as c...
Ruby on Rails provides a model generator you can use to create ActiveRecord models. Simply use rails generate model and provide the model name. $ rails g model user In addition to the model file in app/models, the generator will also create: the Test in test/models/user_test.rb the Fixtures ...

Page 66 of 826