Tutorial by Examples: ed

InterruptedException is a confusing beast - it shows up in seemingly innocuous methods like Thread.sleep(), but handling it incorrectly leads to hard-to-manage code that behaves poorly in concurrent environments. At its most basic, if an InterruptedException is caught it means someone, somewhere, c...
SELECT your_columns, COUNT(*) OVER() as Ttl_Rows FROM your_data_set idnameTtl_Rows1example52foo53bar54baz55quux5 Instead of using two queries to get a count then the line, you can use an aggregate as a window function and use the full result set as the window. This can be used as a base for fur...
You can indent the text inside here documents with tabs, you need to use the <<- redirection operator instead of <<: $ cat <<- EOF This is some content indented with tabs `\t`. You cannot indent with spaces you __have__ to use tabs. Bash will remove empty space befo...
If you want to get the versioned project's data, but you don't need any of the version control capabilities offered by Subversion, you could run svn export <URL> command. Here is an example: $ svn export https://svn.example.com/svn/MyRepo/MyProject/trunk As a result, you will get the proje...
A a pointer to a piece of memory containing n elements may only be dereferenced if it is in the range memory and memory + (n - 1). Dereferencing a pointer outside of that range results in undefined behavior. As an example, consider the following code: int array[3]; int *beyond_array = array + 3; ...
If a remote branch has been deleted, your local repository has to be told to prune the reference to it. To prune deleted branches from a specific remote: git fetch [remote-name] --prune To prune deleted branches from all remotes: git fetch --all --prune
This example uses the Car Table from the Example Databases. SELECT * FROM Cars WHERE TotalCost IN (100, 200, 300) This query will return Car #2 which costs 200 and Car #3 which costs 100. Note that this is equivalent to using multiple clauses with OR, e.g.: SELECT * FROM Cars WHERE TotalCos...
This shows how you can iterate over multiple variables: for { x <- 1 to 2 y <- 'a' to 'd' } println("(" + x + "," + y + ")") (Note that to here is an infix operator method that returns an inclusive range. See the definition here.) This creates the outp...
Go is a statically typed language, meaning you generally have to declare the type of the variables you are using. // Basic variable declaration. Declares a variable of type specified on the right. // The variable is initialized to the zero value of the respective type. var x int var s string va...
The git check-ignore command reports on files ignored by Git. You can pass filenames on the command line, and git check-ignore will list the filenames that are ignored. For example: $ cat .gitignore *.o $ git check-ignore example.o Readme.md example.o Here, only *.o files are defined in .git...
Characters for bulleted lists: * Asterisks + Plus signs - Minus signs Characters for bulleted lists: Asterisks Plus signs Minus signs Please note: For the best results you have to use the same character because as you can see in the example below different signs make the list ...
1. Lists can be nested * Four spaces - Eight spaces + Twelve spaces 2. And back Lists can be nested Four spaces Eight spaces Twelve spaces And back
There are several ways to set which editor to use for committing, rebasing, etc. Change the core.editor configuration setting. $ git config --global core.editor nano Set the GIT_EDITOR environment variable. For one command: $ GIT_EDITOR=nano git commit Or for all commands run in a ...
You can create multiline code snippets by indenting each line with at least four spaces or one tab: #include <stdio.h> int main() { printf("Hello World!\n"); return 0; }
Some parsers allow code to be designated by adding three backticks before and after a section of code. ``` <p><em>This</em> is an HTML example!</p> ``` Optionally, many parsers allow adding syntax highlighting by specifying the code's language immediately after the firs...
Reflection is often used as part of software testing, such as for the runtime creation/instantiation of mock objects. It's also great for inspecting the state of an object at any given point in time. Here's an example of using Reflection in a unit test to verify a protected class member contains the...
The first two arguments to format are an output stream and a control string. Basic use does not require additional arguments. Passing t as the stream writes to *standard-output*. > (format t "Basic Message") Basic Message nil That expression will write Basic Message to standard ou...
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest 693bce725149 6 days ago 967 B postgres 9.5 0f3af79d8673 10 weeks ago 265.7 MB postgres ...
WiredTiger supports LSM trees to store indexes. LSM trees are faster for write operations when you need to write huge workloads of random inserts. In WiredTiger, there is no in-place updates. If you need to update an element of a document, a new document will be inserted while the old document will...
This uses the Dropbox .NET SDK to download a file from the Dropbox API at the remote path to the local file "Test", while tracking progress: var response = await client.Files.DownloadAsync(path); ulong fileSize = response.Response.Size; const int bufferSize = 1024 * 1024; var buffer ...

Page 9 of 145