Tutorial by Examples: c

Preparation $ mkdir globbing $ cd globbing $ mkdir -p folder/{sub,another}folder/content/deepfolder/ touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile $ shopt -u nullglob $ shopt -u failglob $ shopt -u dotglob $ shopt -u nocaseg...
Preparation $ mkdir globbing $ cd globbing $ mkdir -p folder/{sub,another}folder/content/deepfolder/ touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile $ shopt -u nullglob $ shopt -u failglob $ shopt -u dotglob $ shopt -u nocaseg...
Preparation $ mkdir globbing $ cd globbing $ mkdir -p folder/{sub,another}folder/content/deepfolder/ touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile $ shopt -u nullglob $ shopt -u failglob $ shopt -u dotglob $ shopt -u nocaseg...
AlertDialog is a subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. The AlertDialog from android.app package displays differently on different Android OS Versions. The Android V7 Appcompat library pro...
By overloading the indexer you can create a class that looks and feels like an array but isn't. It will have O(1) get and set methods, can access an element at index 100, and yet still have the size of the elements inside of it. The SparseArray class class SparseArray { Dictionary<...
To add EntityFrameworkCore to your project, update the project.json file (add new lines into the dependencies and tools sections): "dependencies": { ... "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer.Des...
One of the most powerful capabilities in Excel is the use of Pivot Tables to sort and analyze data. Using VBA to create and manipulate the Pivots is easier if you understand the relationship of Pivot Tables to Pivot Caches and how to reference and use the different parts of the Tables. At its most ...
Haskell supports pattern matching expressions in both function definition and through case statements. A case statement is much like a switch in other languages, except it supports all of Haskell's types. Let's start simple: longName :: String -> String longName name = case name of ...
Maybe Maybe is a Functor containing a possibly-absent value: instance Functor Maybe where fmap f Nothing = Nothing fmap f (Just x) = Just (f x) Maybe's instance of Functor applies a function to a value wrapped in a Just. If the computation has previously failed (so the Maybe value is ...
The __import__() function can be used to import modules where the name is only known at runtime if user_input == "os": os = __import__("os") # equivalent to import os This function can also be used to specify the file path to a module mod = __import__(r"C:/path/...
An actor inside Service Fabric is defined by a standard .NET interface/class pair: public interface IMyActor : IActor { Task<string> HelloWorld(); } internal class MyActor : Actor, IMyActor { public Task<string> HelloWorld() { return Task.FromResult(&quot...
Until recently, using android.support.v4.app.FragmentPagerAdapter would prevent the usage of a PreferenceFragment as one of the Fragments used in the FragmentPagerAdapter. The latest versions of the support v7 library now include the PreferenceFragmentCompat class, which will work with a ViewPager ...
An atomic type can be used to safely read and write to a memory location shared between two threads. A Bad example that is likely to cause a data race: #include <thread> #include <iostream> //function will add all values including and between 'a' and 'b' to 'result' void add(int...
docker run --name="test-app" --entrypoint="/bin/bash" example-app This command will override the ENTRYPOINT directive of the example-app image when the container test-app is created. The CMD directive of the image will remain unchanged unless otherwise specified: docker run -...
docker run --add-host="app-backend:10.15.1.24" awesome-app This command adds an entry to the container's /etc/hosts file, which follows the format --add-host <name>:<address>. In this example, the name app-backend will resolve to 10.15.1.24. This is particularly useful for t...
For this example, we will use the vector: > x <- 11:20 > x [1] 11 12 13 14 15 16 17 18 19 20 R vectors are 1-indexed, so for example x[1] will return 11. We can also extract a sub-vector of x by passing a vector of indices to the bracket operator: > x[c(2,4,6)] [1] 12 14 16 ...
> List.repeat 3 "abc" ["abc","abc","abc"] : List String You can give List.repeat any value: > List.repeat 2 {a = 1, b = (2,True)} [{a = 1, b = (2,True)}, {a = 1, b = (2,True)}] : List {a : Int, b : (Int, Bool)}
List.sortWith allows you to sort lists with data of any shape - you supply it with a comparison function. compareBools : Bool -> Bool -> Order compareBools a b = case (a,b) of (False, True) -> LT (True, False) -> GT _ -> ...
By default List.sort sorts in ascending order, with the compare function. There are two ways to sort in descending order: one efficient and one inefficient. The efficient way: List.sortWith and a descending comparison function. descending a b = case compare a b of LT -> GT ...
Conditions are a fundamental part of almost any part of code. They are used to execute some parts of the code only in some situations, but not other. Let's look at the basic syntax: a = 5; if a > 10 % this condition is not fulfilled, so nothing will happen disp('OK') end if a < 1...

Page 315 of 826