To view difference between two branch
git diff <branch1>..<branch2>
To view difference between two branch
git diff <commitId1>..<commitId2>
To view diff with current branch
git diff <branch/commitId>
To view summary of changes
git diff --stat <branch/com...
This example adds a new rectangle to the canvas every 1 second (== a 1 second interval)
Annotated Code:
<!doctype html>
<html>
<head>
<style>
body{ background-color:white; }
#canvas{border:1px solid red; }
</style>
<script>
window.onload=(functio...
Pair allows us to treat two objects as one object. Pairs can be easily constructed with the help of template function std::make_pair.
Alternative way is to create pair and assign its elements (first and second) later.
#include <iostream>
#include <utility>
int main()
{
std::p...
In simple terms:
UNION joins 2 result sets while removing duplicates from the result set
UNION ALL joins 2 result sets without attempting to remove duplicates
One mistake many people make is to use a UNION when they do not need to have the duplicates removed. The additional performance cost...
QModelIndex does not actually know about it's parent/child indexes, it only contains a row, a column and a pointer, and it is the models responsibility to use this data to provide information an index's relations. The model therefore needs to do a lot of conversions from the void* stored inside the ...
The elapsedMillis library provides a class with the same name that keeps track of the time that passed since it was created or set to a certain value:
#include <elapsedMillis.h>
#define OUTPIN LED_BUILTIN
#define PERIOD 500
elapsedMillis ledTime;
bool ledState = false;
void setup...
Pattern matching can be used effectively with awk as it controls the actions that follows it i.e. { pattern } { action }. One cool use of the pattern-matching is to select multiple between two patterns in a file say patternA and patternB
$ awk '/patternA/,/patternB/' file
Assume my file contents...
Mouse movement:
import java.awt.Robot;
public class MouseClass {
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
// SET THE MOUSE X Y POSITION
robot.mouseMove(300, 550);
}
}
Press left/right button of mouse:
import java.awt....
When you need a Python list object, you can utilize the tolist() method to convert your array to a list.
my_array = array('i', [1,2,3,4,5])
c = my_array.tolist()
# [1, 2, 3, 4, 5]
A Syntax Tree is an immutable data structure representing the program as a tree of names, commands and marks (as previously configured in the editor.)
For example, assume a Microsoft.CodeAnalysis.Compilation instance named compilation has been configured. There are multiple ways to list the names o...
In some places in Common Lisp, a series of forms are evaluated in order. For instance, in the body of a defun or lambda, or the body of a dotimes. In those cases, writing multiple forms in order works as expected. In a few places, however, such as the then and else parts of an if expressions, onl...
Every Windows Phone project contains App.cs class:
public sealed partial class App : Application
This class is your global application context.
General Application class usage:
App entry point, particularly for various activation contracts.
Application lifecycle management.
Application g...
You can check if a variable has been defined in a scope by using ColdFusion's built in StructKeyExists() function. This can be used inside a <cfif> tag to prevent error messages in the event you attempt to refer to a variable that does not exist. You can also use this function to determine whe...
This code sends a simple text-only email to [email protected]
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'The Profile Name',
@recipients = '[email protected]',
@body = 'This is a simple email sent from SQL Server.',
@subject = 'Simple email'
The IEnumerable<T> interface is the base interface for all generic enumerators and is a quintessential part of understanding LINQ. At its core, it represents the sequence.
This underlying interface is inherited by all of the generic collections, such as Collection<T>, Array, List<T&g...
To create seeders, you may use the make:seeder Artisan command. All seeders generated will be placed in the database/seeds directory.
$ php artisan make:seeder MoviesTableSeeder
Generated seeders will contain one method: run. You may insert data into your database in this method.
<?php
us...
Resolving scoped services during application startup can be difficult, because there is no request and hence no scoped service.
Resolving a scoped service during application startup via app.ApplicationServices.GetService<AppDbContext>() can cause issues, because it will be created in the sc...