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...
Basic foreground images can be inserted into an email document just like they are for web pages:
<img src="http://www.yourserver.com/email/images/logo.png">
And they can be made links by wrapping them in an <a href> tag:
<a href="http://www.yourwebsite.com">...
To indent our outdent the current line in normal mode press the greater than > key or the less than < twice accordingly.
To do the same on multiple lines just add a number beforehand 6>>
CommandDescription>>indent current line<<outdent current line6>>indent next 6 lin...
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"...
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...
// An 8-bit 'byte' value:
byte aByte = (byte)0b00100001;
// A 16-bit 'short' value:
short aShort = (short)0b1010000101000101;
// Some 32-bit 'int' values:
int anInt1 = 0b10100001010001011010000101000101;
int anInt2 = 0b101;
int anInt3 = 0B101; // The B can be upper or lower case.
// A ...
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...
If you are using Windows open Git Bash.
If you are using Mac or Linux open your Terminal.
Before you generate an SSH key, you can check to see if you have any existing SSH keys.
List the contents of your ~/.ssh directory:
$ ls -al ~/.ssh
# Lists all the files in your ~/.ssh directory
Check...
// 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...