Tutorial by Examples

The typeof a tuple is a subtype of Tuple: julia> typeof((1, 2, 3)) Tuple{Int64,Int64,Int64} julia> typeof((1.0, :x, (1, 2))) Tuple{Float64,Symbol,Tuple{Int64,Int64}} Unlike other data types, Tuple types are covariant. Other data types in Julia are generally invariant. Thus, julia>...
Because Julia function parameter lists are themselves tuples, dispatching on various kinds of tuples is often easier done through the method parameters themselves, often with liberal usage for the "splatting" ... operator. For instance, consider the implementation of reverse for tuples, fr...
Tuples are frequently used for multiple return values. Much of the standard library, including two of the functions of the iterable interface (next and done), returns tuples containing two related but distinct values. The parentheses around tuples can be omitted in certain situations, making multip...
The IIF statement can be used in expressions to screen for division by zero: =IIF(Fields!PossibleZero.Value=0,0,Fields!Denominator.Value/IIF(Fields!PossibleZero.Value=0,1,Fields!PossibleZero.Value)) SSRS does not short circuit IIF arguments. Therefore, using a single IIF function to screen for ...
In order to use a plain-text editor to create a Console application that is written in C#, you'll need the C# Compiler. The C# Compiler (csc.exe), can be found at the following location: %WINDIR%\Microsoft.NET\Framework64\v4.0.30319\csc.exe N.B. Depending upon which version of the .NET Framework t...
svn2git is a Ruby wrapper around git's native SVN support through git-svn, helping you with migrating projects from Subversion to Git, keeping history (incl. trunk, tags and branches history). Examples To migrate a svn repository with the standard layout (ie. branches, tags and trunk at the root l...
Given a CLLocationDistance (simply a Double representing meters), output a user-readable string: let distance = CLLocationDistance(42) let formatter = MKDistanceFormatter() let answer = formatter.stringFromDistance(distance) // answer = "150 feet" Objective-C CLLocationDistance dis...
import Mapkit Set units to one of .Default, .Metric, .Imperial, .ImperialWithYards: formatter.units = .Metric var answer = formatter.stringFromDistance(distance) // "40 m" formatter.units = .ImperialWithYards answer = formatter.stringFromDistance(distance) // "50 yards" ...
Set unitStyle to one of .Default, .Abbreviated, .Full: formatter.unitStyle = .Full var answer = formatter.stringFromDistance(distance) // "150 feet" formatter.unitStyle = .Abbreviated answer = formatter.stringFromDistance(distance) // "150 ft" Objective-C formatter.un...
inputype attribute in EditText widget: (tested on Android 4.4.3 and 2.3.3) <EditText android:id="@+id/et_test" android:inputType="?????"/> textLongMessage= Keyboard: alphabet/default. Enter button: Send/Next. Emotion: yes. Case: lowercase. Suggestion: yes. Add. chars: ,...
RowAB1FruitApple2WeekdayMonday3AnimalDog Formula on C1 ={A1:A3} Result RowC1Fruit2Weekday3Dog Alternative formula =ARRAYFORMULA(A1:A3)
The simplest manner of defining custom behavior for individual routes would be fairly easy. In this example we use it to authenticate a user : 1) routes.js: create a new property (like requireAuth) for any desired route angular.module('yourApp').config(['$routeProvider', function($routeProvider) ...
using System.Diagnostics.Contracts; public int IncrementByRandomAmount(int input) { Contract.Requires<ArgumentNullException>(input != null); // Don't allow null parameter. Contract.Requires<ArgumentOutOfRangeException>(input < int.MaxValue); // We can't do anything if...
This example attempts to mimic the behavior of the built-in path construction operators like arc. If there is a current point, poly first draws a line to (x,y)+(r,0), otherwise it starts by moving to that point. Instead of gsave ... grestore (which has the undesirable effect of discarding the very...
This snippet dumps the contents of the current path to stdout. It uses the ghostscript procedure =only which may not be available on all interpreters. An equivalent procedure on Adobe interpreters is called =print. pathforall is a looping operator which takes 4 procedure bodies as arguments which a...
Create an instance of Mobile Analytics for Bluemix. Add the Bluemix Mobile Services SDK to your iOS project. After installing the SDK, add these import statements at top of your AppDelegate.swift file: import BMSCore import BMSAnalytics Next you'll need to initialize and send mobile ana...
Floating point Numbers can be formatted as a decimal number using String.format with 'f' flag //Two digits in fracttional part are rounded String format1 = String.format("%.2f", 1.2399); System.out.println(format1); // "1.24" // three digits in fractional pa...
It is sometimes useful to integrate a custom error logging framework to ensure all exceptions are logged. [ServiceContract] [ErrorHandler] public interface IMyService { } [AttributeUsage(AttributeTargets.Interface)] public class CustomErrorHandler : Attribute, IContractBehavior, IE...
Lets say you have a simple ApiController like this: [HttpGet] [Route("test")] public dynamic Test() { dynamic obj = new ExpandoObject(); obj.prop1 = "some string"; obj.prop2 = 11; obj.prop3 = "another string"; ...
Setup Install AWS CLI AWS CLI is an common CLI tool for managing the AWS resources. With this single tool we can manage all the aws resources sudo apt-get install -y python-dev python-pip sudo pip install awscli aws --version aws configure Bash one-liners cat <file> # output a file ...

Page 910 of 1336