Tutorial by Examples: c

Variable declaration @buttonColor: #FF0000; /* Now you can use @buttonColor variable with css Functions. */ .product.into.detailed { additional-attributes{ .lib-table-button( background-color: @buttonColor; ); } } Here function lib-tabgle-button used v...
Your typical jQuery object will contain references to any number of DOM elements, and that's why jQuery objects are often referred to as collections. If you want to do any manipulating with specific elements (e.g. getting a data attribute, calculating specific positions) then you need to use .each()...
You may want to do this if the remote repository is migrated. The command for changing the remote url is: git remote set-url It takes 2 arguments: an existing remote name (origin, upstream) and the url. Check your current remote url: git remote -v origin https://bitbucket.com/develop/myrep...
A higher-order function, as opposed to a first-order function, can have one of three forms: One or more of its parameters is a function, and it returns some value. It returns a function, but none of its parameters is a function. Both of the above: One or more of its parameters is a fu...
If we have a c++ project that uses a config.h configuration file with some custom paths or variables, we can generate it using CMake and a generic file config.h.in. The config.h.in can be part of a git repository, while the generated file config.h will never be added, as it is generated from the cu...
<?php namespace App; use Illuminate\Database\Eloquent\Model; class User extends Model { /** * Get the user's first name. * * @param string $value * @return string */ public function getFirstNameAttribute($value) { return ucfirst($v...
If you have a cmake module . You can create a folder called in to store all config files. For example,you have a project called FOO, you can create a FOO_config.h.in file like: //=================================================================================== // CMake configuration file, base...
Comparator cmp = [ compare:{ a, b -> a <=> b } ] as Comparator def col = [ 'aa', 'aa', 'nn', '00' ] SortedSet sorted = new TreeSet( cmp ) sorted.addAll col assert '[00, aa, nn]' == sorted.toString()
Here is a very simple example of a function that "promises to proceed when a given time elapses". It does that by creating a new Deferred object, that is resolved later and returning the Deferred's promise: function waitPromise(milliseconds){ // Create a new Deferred object using th...
Correlated (also known as Synchronized or Coordinated) Subqueries are nested queries that make references to the current row of their outer query: SELECT EmployeeId FROM Employee AS eOuter WHERE Salary > ( SELECT AVG(Salary) FROM Employee eInner WHERE eInner.Dep...
my @letters = ( 'a' .. 'z' ); # English ascii-bet print $letters[ rand @letters ] for 1 .. 5; # prints 5 letters at random How it works rand EXPR expects a scalar value, so @letters is evaluated in scalar context An array in scalar context returns the number of elements it ...
The series of events here is supposed to work as follows: Compile code with -pg option Link code with -pg option Run program Program generates gmon.out file Run gprof program To add profiling flags, you must add to your CMakeLists.txt: SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg&quot...
Inheritance among models can be done in two ways: a common abstract class (see the "Model mixins" example) a common model with multiple tables The multi tables inheritance will create one table for the common fields and one per child model example: from django.db import models c...
The example reads the first line from a file. It uses an instance of BufferedReader to read data from the file. BufferedReader is a resource that must be closed after the program is finished with it: static String readFirstLineFromFile(String path) throws IOException { try (BufferedReader br = n...
The following example shows other ways you can use the underscore in numeric literals: long creditCardNumber = 1234_5678_9012_3456L; long socialSecurityNumber = 999_99_9999L; float pi = 3.14_15F; long hexBytes = 0xFF_EC_DE_5E; long hexWords = 0xCAFE_BABE; long maxLong = 0x7fff_ffff_ffff_ffffL;...
You can use Map<String, List<String>> myMap = new HashMap<>(); instead of Map<String, List<String>> myMap = new HashMap<String, List<String>>(); However, you can't use List<String> list = new ArrayList<>(); list.add("A"); ...
public String getTypeOfDayWithSwitchStatement(String dayOfWeekArg) { String typeOfDay; switch (dayOfWeekArg) { case "Monday": typeOfDay = "Start of work week"; break; case "Tuesday": case "Wednes...
// Takes a callback and executes it with the read value def readFile(path: String)(callback: Try[String] => Unit): Unit = ??? readFile(path) { _.flatMap { file1 => readFile(path2) { _.foreach { file2 => processFiles(file1, file2) }} }} The function argument to readFile is...
If shift is called outside of a delimiting reset block, it can be used to create functions that themselves create continuations inside a reset block. It is important to note that shift's type is not just (((A => B) => C) => A), it is actually (((A => B) => C) => (A @cpsParam[B, C])...
We can have three cases to analyze an algorithm: Worst Case Average Case Best Case #include <stdio.h> // Linearly search x in arr[]. If x is present then return the index, // otherwise return -1 int search(int arr[], int n, int x) { int i; for (i=0; i<n; i...

Page 667 of 826