Tutorial by Examples: er

Snippet from MyExampleFile.xaml <TextBlock Foreground="{ThemeResource SystemControlBackgroundAccentBrush}" Text="This is a colored textbox that use the Accent color of your Windows 10"/> <TextBlock Foreground="{ThemeResource SystemControlBackgroundBa...
Snippet from MyExampleFile.xaml <TextBlock x:Name="MyTextBlock" Text="This is a TextBlock colored from the code behind"/> Snippet from MyExampleFile.xaml.cs // We use the application's Resource dictionary to get the current Accent of your Windows 10 ...
Aliases are named shortcuts of commands, one can define and use in interactive bash instances. They are held in an associative array named BASH_ALIASES. To use this var in a script, it must be run within an interactive shell #!/bin/bash -li # note the -li above! -l makes this behave like a login s...
To generate samples of cryptographically random data: final byte[] sample = new byte[16]; new SecureRandom().nextBytes(sample); System.out.println("Sample: " + DatatypeConverter.printHexBinary(sample)); Produces output similar to: Sample: E4F14CEA2384F70B706B53A6DF8C5EFE Note...
To generate key pairs using different algorithms and key sizes: final KeyPairGenerator dhGenerator = KeyPairGenerator.getInstance("DiffieHellman"); final KeyPairGenerator dsaGenerator = KeyPairGenerator.getInstance("DSA"); final KeyPairGenerator rsaGenerator = KeyPairGenerator...
Create In order to perform a Create operation via REST, you must perform the following actions: Create an HTTP request using the POST verb. Use the service URL of the list to which you want to add an entity as the target for the POST. Set the content type to application/json. Serialize the JSON...
To compute a signature: final PrivateKey privateKey = keyPair.getPrivate(); final byte[] data = "FOO BAR".getBytes(); final Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(privateKey); signer.update(data); final byte[] signature = signer.sign();...
You can change the "$" delimiter to any other. The following example: from string import Template class MyOtherTemplate(Template): delimiter = "#" data = dict(id = 1, name = "Ricardo") t = MyOtherTemplate("My name is #name and I have the id: #id&quot...
Usually, services call remote Api to retrieve/send data. But unit tests shouldn't do network calls. Angular internally uses XHRBackend class to do http requests. User can override this to change behavior. Angular testing module provides MockBackend and MockConnection classes which can be used to tes...
'Note: I use this method to extract non-html data in extracted GET telnet results 'This example effectively grabs every other vehicle that have start and finish 'characters, which in this case is "/". 'Resulting in an array like this: 'extractedData(0) = "/Jeep" 'extractedD...
Dim exStr : exStr = " <Head>data</Head> " Dim res res = Ucase(Replace(Mid(exStr, instr(exStr, ">")+1,4), "ata", "ark")) 'res now equals DARK 'instr(exStr, ">") returns 7 'Mid(" <Head>data</Head> ", 7+1,...
typealias SuccessHandler = (NSURLSessionDataTask, AnyObject?) -> Void This code block creates a type alias named SuccessHandler, just in the same way var string = "" creates a variable with the name string. Now whenever you use SuccessHandler, for example: func example(_ handler: S...
typealias Number = NSNumber You can also use a type alias to give a type another name to make it easier to remember, or make your code more elegant. typealias for Tuples typealias PersonTuple = (name: String, age: Int, address: String) And this can be used as: func getPerson(for name: Strin...
The following command lists out the queries that are currently being run on the server db.currentOp() The output looks something similar to this { "inprog" : [ { "opid" : "302616759", "active" : true, &...
C++11 offers tools that enhance the functionality of RAII-encapsulated OpenGL objects. Without C++11 features like move semantics, such objects would have to be dynamically allocated if you want to pass them around, since they cannot be copied. Move support allows them to be passed back and forth li...
PermissionUtil is a simple and convenient way of asking for permissions in context. You can easily provide what should happen in case of all requested permissions granted (onAllGranted()), any request was denied (onAnyDenied()) or in case that a rational is needed (onRational()). Anywhere in your A...
A feature that has near zero variance is a good candidate for removal. You can manually detect numerical variance below your own threshold: data("GermanCredit") variances<-apply(GermanCredit, 2, var) variances[which(variances<=0.0025)] Or, you can use the caret package to find...
If a feature is largely lacking data, it is a good candidate for removal: library(VIM) data(sleep) colMeans(is.na(sleep)) BodyWgt BrainWgt NonD Dream Sleep Span Gest 0.00000000 0.00000000 0.22580645 0.19354839 0.06451613 0.06451613 0.06451613 Pred ...
Create groovy file by path $JENKINS_HOME/init.groovy.d/basic-security.groovy In Ubuntu 16 Jenkins home directory places in /var/lib/jenkins Place in file next code #!groovy import jenkins.model.* import hudson.security.* def instance = Jenkins.getInstance() def hudsonRealm = new...
The update pattern in D3 version 3 A correct understanding of how the “enter”, “update” and “exit” selections work is fundamental for properly changing the dataviz using D3. Since D3 version 3 (actually, since version 2), this snippet could set the transitions for both “enter” and “update” selecti...

Page 315 of 417