Tutorial by Examples: c

Example of declarations are: int a; /* declaring single identifier of type int */ The above declaration declares single identifier named a which refers to some object with int type. int a1, b1; /* declaring 2 identifiers of type int */ The second declaration declares 2 identifiers named a1 a...
import scala.util.parsing.combinator._ class SimpleParser extends RegexParsers { // Define a grammar rule, turn it into a regex, and apply it the input. def word: Parser[String] = """[A-Z][a-z]+""".r ^^ { _.toString } } object SimpleParser extends SimplePar...
The following uses a variable with a for loop to rename a group of files. SetLocal EnableDelayedExpansion for %%j in (*.*) do ( set filename=%%~nj set filename=!filename:old=new! set filename=Prefix !filename! set filename=!filename! Suffix ren "%%j" "!filename!%%~x...
Sometimes you need to call a Tcl command from your expression. For example, supposing you need the length of a string in it. To do that, you just use a [...] sequence in the expression: set halfTheStringLength [expr { [string length $theString] / 2 }] You can call any Tcl command this way, but i...
This example is based on a blog post by Nicolas Hery. It utilizes ES6 classes and ReactJS's lifecycle methods to keep the D3 component updated d3_react.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Hello, d3React!</title>...
CSS div { width: 200px; height: 200px; background: url(http://lorempixel.com/200/200/abstract/6); mask-image: radial-gradient(circle farthest-side at center, transparent 49%, white 50%); /* check remarks before using */ } HTML In the above example, a transparent circle is created...
CSS div { /* check remarks before usage */ height: 200px; width: 400px; background-image: url(http://lorempixel.com/400/200/nature/4); mask-image: linear-gradient(to top right, transparent 49.5%, white 50.5%), linear-gradient(to top left, transparent 49.5%, white 50.5%), linear-gradient...
When inheriting from any base class, only one partial class needs to have the base class specified. // PartialClass1.cs public partial class PartialClass : BaseClass {} // PartialClass2.cs public partial class PartialClass {} You can specify the same base class in more than one partial clas...
$ git show dae86e1950b1277e545cee180551750029cfe735 $ git show dae86e19 You can specify revision (or in truth any object: tag, tree i.e. directory contents, blob i.e. file contents) using SHA-1 object name, either full 40-byte hexadecimal string, or a substring that is unique to the repository. ...
$ git log master # specify branch $ git show v1.0 # specify tag $ git show HEAD # specify current branch $ git show origin # specify default remote-tracking branch for remote 'origin' You can specify revision using a symbolic ref name, which includes branches (for example 'master'...
$ git show @{1} # uses reflog for current branch $ git show master@{1} # uses reflog for branch 'master' $ git show HEAD@{1} # uses 'HEAD' reflog A ref, usually a branch or HEAD, followed by the suffix @ with an ordinal specification enclosed in a brace pair (e.g. {1}, {1...
$ git show master@{yesterday} $ git show HEAD@{5 minutes ago} # or HEAD@{5.minutes.ago} A ref followed by the suffix @ with a date specification enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3 days 1 hour 1 second ago} or {1979-02-26 18:30:00}) specifies the value of the ref at ...
$ git log @{upstream}.. # what was done locally and not yet published, current branch $ git show master@{upstream} # show upstream of branch 'master' The suffix @{upstream} appended to a branchname (short form <branchname>@{u}) refers to the branch that the branch specified by branc...
$ git reset --hard HEAD^ # discard last commit $ git rebase --interactive HEAD~5 # rebase last 4 commits A suffix ^ to a revision parameter means the first parent of that commit object. ^<n> means the <n>-th parent (i.e. <rev>^ is equivalent to <rev>^1). A...
In some cases the behavior of a command depends on whether it is given branch name, tag name, or an arbitrary revision. You can use "de-referencing" syntax if you need the latter. A suffix ^ followed by an object type name (tag, commit, tree, blob) enclosed in brace pair (for example v0.9...
$ git show HEAD^{/fix nasty bug} # find starting from HEAD $ git show ':/fix nasty bug' # find starting from any branch A colon (':'), followed by a slash ('/'), followed by a text, names a commit whose commit message matches the specified regular expression. This name returns the younge...
It is possible to change Code Folding preference to suit your need. Thus code folding can be set enable/unable for specific constructs (ex: if block, for loop, Sections ...). To change folding preferences, go to Preferences -> Code Folding: Then you can choose which part of the code can be f...
Instead of linking to an external file, you can also include the JS code as-is in your HTML: <script> // JavaScript code </script>
To build vim from source on Ubuntu: Get a copy of the source code by downloading from the official Vim repository on GitHub. Get the dependencies by running $ sudo apt-get build-dep vim-gnome or similar. Go to the directory of the Vim source code: cd vim/src Run $ ./configure. You can customiz...
If we consider a heterogenous list, wherein the elements of the list have varied but known types, it might be desirable to be able to perform operations on the elements of the list collectively without discarding the elements' type information. The following example implements a mapping operation ov...

Page 309 of 826