Tutorial by Examples: a

You can quickly determine if a text includes a specific pattern using Regex. There are multiple ways to work with Regex in PowerShell. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Content wrapped in () $pattern = '\(.*?\)' Using ...
A common task for regex is to replace text that matches a pattern with a new value. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Text wrapped in () $pattern = '\(.*?\)' #Replace matches with: $newvalue = 'test' Using -Replace...
Sometimes you need to replace a value matching a pattern with a new value that's based on that specific match, making it impossible to predict the new value. For these types of scenarios, a MatchEvaluator can be very useful. In PowerShell, a MatchEvaluator is as simple as a scriptblock with a singl...
A regex-pattern uses many special characters to describe a pattern. Ex., . means "any character", + is "one or more" etc. To use these characters, as a .,+ etc., in a pattern, you need to escape them to remove their special meaning. This is done by using the escape character whi...
There are multiple ways to find all matches for a pattern in a text. #Sample text $text = @" This is (a) sample text, this is a (sample text) "@ #Sample pattern: Content wrapped in () $pattern = '\(.*?\)' Using Select-String You can find all matches (global match) by adding t...
You can delete existing snapshots of database using DELETE DATABASE statement: DROP DATABASE Mydatabase_morning In this statement you should reference name of the database snapshot.
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...
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" ...
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...

Page 742 of 1099