Tutorial by Examples: app

For example calculating the average of each i-th element of multiple iterables: def average(*args): return float(sum(args)) / len(args) # cast to float - only mandatory for python 2.x measurement1 = [100, 111, 99, 97] measurement2 = [102, 117, 91, 102] measurement3 = [104, 102, 95, 101] ...
Let's say we have a query of the remaining horsemen that needs to populate a Person class. NameBornResidenceDaniel Dennett1942United States of AmericaSam Harris1967United States of AmericaRichard Dawkins1941United Kingdom public class Person { public string Name { get; set; } public int...
Let's look at a more complex example that contains a one-to-many relationship. Our query will now contain multiple rows containing duplicate data and we will need to handle this. We do this with a lookup in a closure. The query changes slightly as do the example classes. IdNameBornCountryIdCountry...
Sometimes the number of types you are mapping exceeds the 7 provided by the Func<> that does the construction. Instead of using the Query<> with the generic type argument inputs, we will provide the types to map to as an array, followed by the mapping function. Other than the initial ma...
If the query column names do not match your classes you can setup mappings for types. This example demonstrates mapping using System.Data.Linq.Mapping.ColumnAttributeas well as a custom mapping. The mappings only need to be setup once per type so set them on application startup or somewhere else ...
Truncate > Create specified file if it does not exist. Truncate (remove file's content) Write to file $ echo "first line" > /tmp/lines $ echo "second line" > /tmp/lines $ cat /tmp/lines second line Append >> Create specified file if it does not e...
In order to begin building with PayPal APIs, you have to create an application to obtain a client ID and secret. Go to https://developer.paypal.com/developer/applications/, sign in, and click on "Create App", as shown below: Next, enter an application name, select the sandbox testing a...
object HelloWorld extends App { println("Hello, world!") } Live demo By extending the App trait, you can avoid defining an explicit main method. The entire body of the HelloWorld object is treated as "the main method". 2.11.0 Delayed Initialization Per the official d...
First, establish if the device is capable of accepting Touch ID input. if (context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out AuthError)) If it does then we can display the Touch ID UI by using: context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometri...
All instances of Preferences are always thread-safe across the threads of a single Java Virtual Machine (JVM). Because Preferences can be shared across multiple JVMs, there are special methods that deal with synchronizing changes across virtual machines. If you have an application which is supposed...
re.findall(r"[0-9]{2,3}", "some 1 text 12 is 945 here 4445588899") # Out: ['12', '945', '444', '558', '889'] Note that the r before "[0-9]{2,3}" tells python to interpret the string as-is; as a "raw" string. You could also use re.finditer() which works in...
A wide variety of standard library functions have among their effects copying byte sequences from one memory region to another. Most of these functions have undefined behavior when the source and destination regions overlap. For example, this ... #include <string.h> /* for memcpy() */ ch...
// Java: long count = items.stream().filter( item -> item.startsWith("t")).count(); // Kotlin: val count = items.filter { it.startsWith('t') }.size // but better to not filter, but count with a predicate val count = items.count { it.startsWith('t') }
slice = append(slice, "hello", "world")
apply is used to evaluate a function (maybe an anonymous one) over the margins of an array or matrix. Let's use the iris dataset to illustrate this idea. The iris dataset has measurements of 150 flowers from 3 species. Let's see how this dataset is structured: > head(iris) Sepal.Length Sep...
A custom component that takes the type of a component as input and creates an instance of that component type inside itself. When the input is updated, the previously added dynamic component is removed and the new one added instead. @Component({ selector: 'dcl-wrapper', template: `<div #...
Rails uses sqlite3 as the default database, but you can generate a new rails application with a database of your choice. Just add the -d option followed by the name of the database. $ rails new MyApp -T -d postgresql This is a (non-exhaustive) list of available database options: mysql oracle...
To develop an application for iOS, you should start with an application called Xcode. There are other alternative tools you can use, but Xcode is Apple's official tool. Note, however, that it only runs on macOS. The latest official version is Xcode 8.3.3 with Xcode 9 (currently in beta) due to be re...
To create and run new WPF project in Visual Studio: Click File → New → Project Select template by clicking Templates → Visual C# → Windows → WPF Application and press OK: Open MainWindow.xaml file in Solution Explorer (if you don't see Solution Explorer window, open it by clicking V...
Download and install Visual Studio. Visual Studio can be downloaded from VisualStudio.com. The Community edition is suggested, first because it is free, and second because it involves all the general features and can be extended further. Open Visual Studio. Welcome. Go to File → New ...

Page 2 of 33