Tutorial by Examples: bas

Running the command: grep sam someFile.txt When someFile.txt contains: fred 14 m foo sam 68 m bar christina 83 f baz bob 22 m qux Sam 41 m quux Will produce this output: sam 68 m bar
macro(set_my_variable _INPUT) if("${_INPUT}" STREQUAL "Foo") set(my_output_variable "foo") else() set(my_output_variable "bar") endif() endmacro(set_my_variable) Use the macro: set_my_variable("Foo") message(STATUS ${my_outpu...
sqldf() from the package sqldf allows the use of SQLite queries to select and manipulate data in R. SQL queries are entered as character strings. To select the first 10 rows of the "diamonds" dataset from the package ggplot2, for example: data("diamonds") head(diamonds) #...
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] def index @posts = Post.all end def show end def new @post = Post.new end def edit end def create @post = Post.new(post_par...
Python lists are 0-based i.e. the first element in the list can be accessed by the index 0 arr = ['a', 'b', 'c', 'd'] print(arr[0]) >> 'a' You can access the second element in the list by index 1, third element by index 2 and so on: print(arr[1]) >> 'b' print(arr[2]) >> '...
page = PAGE page.10 = TEXT page.10.value = HELLO WORLD Usually this typoScript snippets are added to Web >> Template >> Info/Modify >> setup This snippet opens a new PAGE object. Inside the PAGE object, the 10th entry is set to be a TEXT object. The value of thus TEXT object ...
If you are familiar with jQuery and Sizzle syntax, d3 selections should not be much different. d3 mimics the W3C Selectors API to make interacting with elements easier. For a basic example, to select all <p> and add a change to each of them: d3.selectAll('p') .attr('class','textClass') ...
The <div> element usually has no specific semantic meaning by itself, simply representing a division, and is typically used for grouping and encapsulating other elements within an HTML document and separating those from other groups of content. As such, each <div> is best described by it...
C++11 In the header file: // widget.h #include <memory> // std::unique_ptr #include <experimental/propagate_const> class Widget { public: Widget(); ~Widget(); void DoSomething(); private: // the pImpl idiom is named after the typ...
PropertyPossible Valuesdisplaygrid / inline-grid The CSS Grid is defined as a display property. It applies to a parent element and its immediate children only. Consider the following markup: <section class="container"> <div class="item1">item1</div> &lt...
In Aurelia all HTML templates are defined inside of opening and closing <template></template> tags. All of your HTML and Aurelia specific logic goes inside of these template tags and cannot exist outside of them. <template> </template>
Enumerating dictionaries allows you to run a block of code on each dictionary key-value pair using the method enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block Example: NSDictionary stockSymbolsDictionary = @{ @"AAPL":...
Whenever you declare a new rule inside another rule it is called nesting. With basic nesting, as shown below, the nested selector will be compiled as a new CSS selector with all its parents prepended, separated by a space. // SCSS .parent { margin: 1rem; .child { float: left; } ...
If your project has no external dependency and has foo.ml as its main entry point, you can compile a bytecode version with ocamlbuild foo.byte To get a native executable, run ocamlbuild foo.native
Encoding //Create a Base64 Encoded NSString Object NSData *nsdata = [@"iOS Developer Tips encoded in Base64" dataUsingEncoding:NSUTF8StringEncoding]; // Get NSString from NSData object in Base64 NSString *base64Encoded = [nsdata base64EncodedStringWithOptions:0]; // Print the B...
In this example we will calculate the squared deviance for each column in a data frame, in this case the mtcars. Option A: integer index squared_deviance <- vector("list", length(mtcars)) for (i in seq_along(mtcars)){ squared_deviance[[i]] <- (mtcars[[i]] - mean(mtcars[[i]]))^2...
Vector based graphics are represented by a plethora of data that must be computed by the CPU (vector points, arcs, colors, etc). Anything other than simple shapes with minimal points and straight lines will consume vast amounts of CPU resource. There is a "Cache as Bitmap" flag that can b...
vim is a modal editor. This means that at any time inside a vim session, the user is going to be in one of the modes of operation. Each one of offers a different set commands, operations, key bindings... Normal mode (or Command mode) The mode vim starts in. From other modes, usually accessible ...
name:john Searches for a single term (joe) in a single field (name)
<div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <!--- vvv Hamburger icon that gets shown when window reaches a certain scale vvv ---> <button type...

Page 14 of 65