Tutorial by Examples: diff

In the following examples, we'll be using the following samples: List<Product> Products = new List<Product>() { new Product() { ProductId = 1, Name = "Book nr 1", Price = 25 }, new Product() { ProductId = 2, Name = "Book nr 2&quot...
You can diff UTF-16 encoded files (localization strings file os iOS and macOS are examples) by specifying how git should diff these files. Add the following to your ~/.gitconfig file. [diff "utf16"] textconv = "iconv -f utf-16 -t utf-8" iconv is a program to convert differe...
composer update composer update will update our dependencies as they are specified in composer.json. For example, if our project uses this configuration: "require": { "laravelcollective/html": "2.0.*" } Supposing we have actually installed the 2.0.1 version ...
You can select elements with different selectors : by tag : "div" by class : ".class" by id : "#id" by attribute : "[color=blue]" multiple selectors (OR): "div1, div2, class1" multiple selectors (AND): "div1 div2 class1"
In oracle, the difference (in days and/or fractions thereof) between two DATEs can be found using subtraction: SELECT DATE '2016-03-23' - DATE '2015-12-25' AS difference FROM DUAL; Outputs the number of days between the two dates: DIFFERENCE ---------- 89 And: SELECT TO_DATE( '201...
$(window).load() was deprecated in jQuery version 1.8 (and completely removed from jQuery 3.0) and as such should not be used anymore. The reasons for the deprecation are noted on the jQuery page about this event Caveats of the load event when used with images A common challenge developers attem...
Simple form using one variable: for i := 0; i < 10; i++ { fmt.Print(i, " ") } Using two variables (or more): for i, j := 0, 0; i < 5 && j < 10; i, j = i+1, j+2 { fmt.Println(i, j) } Without using initialization statement: i := 0 for ; i < 10; i++ {...
Although people often say Sass as the name of this CSS-preprocessor, they often mean the SCSS-syntax. Sass uses the .sass file extension, while SCSS-Sass uses the .scss extension. They are both referred to as "Sass". Speaking generally, the SCSS-syntax is more commonly used. SCSS looks li...
Sometimes a term is defined in multiple sections of the manual. By default, man will only display the first page it finds, which can be annoying for programmers because C functions are documented in a later section than commands and system calls. Use the following to display all pages that match a...
Generates a storable representation of a value. This is useful for storing or passing PHP values around without losing their type and structure. To make the serialized string into a PHP value again, use unserialize(). Serializing a string $string = "Hello world"; echo serialize($s...
Unlike durations, periods can be used to accurately model clock times without knowing when events such as leap seconds, leap days, and DST changes occur. start_2012 <- ymd_hms("2012-01-01 12:00:00") ## [1] "2012-01-01 12:00:00 UTC" # period() considers leap year calculati...
GROUP BY is used in combination with aggregation functions. Consider the following table: orderIduserIdstoreNameorderValueorderDate143Store A2520-03-2016257Store B5022-03-2016343Store A3025-03-2016482Store C1026-03-2016521Store A4529-03-2016 The query below uses GROUP BY to perform aggregated calc...
var user = Sitecore.Security.Accounts.User.FromName("sitecore/testname", false); using (new Sitecore.Security.Accounts.UserSwitcher(user)) { var item = Sitecore.Context.Database.GetItem("/sitecore/content/home"); }
the timedelta module comes in handy to compute differences between times: from datetime import datetime, timedelta now = datetime.now() then = datetime(2016, 5, 23) # datetime.datetime(2016, 05, 23, 0, 0, 0) Specifying time is optional when creating a new datetime object delta = now-then ...
You can iterate on the object returned by groupby(). The iterator contains (Category, DataFrame) tuples. # Same example data as in the previous example. import numpy as np import pandas as pd np.random.seed(0) df = pd.DataFrame({'Age': np.random.randint(20, 70, 100), 'Sex':...
Maps and keyword lists have different application. For instance, a map cannot have two keys with the same value and it's not ordered. Conversely, a Keyword list can be a little bit hard to use in pattern matching in some cases. Here's a few use cases for maps vs keyword lists. Use keyword lists wh...
The most feasible way is to use, the DateTime class. An example: <?php // Create a date time object, which has the value of ~ two years ago $twoYearsAgo = new DateTime("2014-01-18 20:05:56"); // Create a date time object, which has the value of ~ now $now = new DateTime("2016...
This illustrates that union members shares memory and that struct members does not share memory. #include <stdio.h> #include <string.h> union My_Union { int variable_1; int variable_2; }; struct My_Struct { int variable_1; int variable_2; }; int main (void) { ...
Sometimes you just need a diff to apply using patch. The regular git --diff does not work. Try this instead: git diff --no-prefix > some_file.patch Then somewhere else you can reverse it: patch -p0 < some_file.patch
NotificationCompat.Builder mBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.some_small_icon) .setContentTitle("Title") .setContentText("This is a test notification with MAX priority")...

Page 3 of 10