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...
It is used to duplicate a git repository from gerrit to anyway. Configuration file is $GERRIT_INSTALL/etc/replication.config.
Config file example to clone MyRepo from gerrit to backupServer
[remote "backup"]
url = ProjectUrlOnBackupServer/${name} #Example backup.some.org:/pub/git/${...
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...
By default, routes only respond to GET requests. You can change this behavior by supplying the methods argument to the route() decorator.
from flask import request
@app.route('/login', methods=['GET', 'POST'])
def login():
if request.method == 'POST':
do_the_login()
else:
...
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 ...
Closely correlated features may add variance to your model, and removing one of a correlated pair might help reduce that. There are lots of ways to detect correlation. Here's one:
library(purrr) # in order to use keep()
# select correlatable vars
toCorrelate<-mtcars %>% keep(is.numeric)
...
By default all enum values are resolved to numbers. Let's say if you have something like
enum MimeType {
JPEG,
PNG,
PDF
}
the real value behind e.g. MimeType.PDF will be 2.
But some of the time it is important to have the enum resolve to a different type. E.g. you receive the value fr...
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...
Open Jenkins default config file and add in JAVA_ARGS next key -Djenkins.install.runSetupWizard=false
In Ubuntu 16 default file places in /etc/default/jenkins
Create groovy file by path $JENKINS_HOME/init.groovy.d/basic-security.groovy
In Ubuntu 16 Jenkins home directory places in /var/li...
(This assumes MySQL has been installed and that sudo is being used.)
Generating a CA and SSL keys
Make sure OpenSSL and libraries are installed:
apt-get -y install openssl
apt-get -y install libssl-dev
Next make and enter a directory for the SSL files:
mkdir /home/ubuntu/mysqlcerts
cd /home...
If you want to match a backslash in your regular expression, you'll have to escape it.
Backslash is an escape character in regular expressions. You can use '\\' to refer to a single backslash in a regular expression.
However, backslash is also an escape character in Java literal strings. To make a...
Use the ls() commands to find objects by name:
freds = cmds.ls("fred")
#finds all objects in the scene named exactly 'fred', ie [u'fred', u'|group1|fred']
Use * as a wildcard:
freds = cmds.ls("fred*")
# finds all objects whose name starts with 'fred'
# [u'fred', u'freder...
Using canvas elements
HTML provides the canvas element for building raster-based images.
First build a canvas for holding image pixel information.
var canvas = document.createElement('canvas');
canvas.width = 500;
canvas.height = 250;
Then select a context for the canvas, in this case two-di...
To add the BottomNavigationView follow these steps:
Add in your build.gradle the dependency:
compile 'com.android.support:design:25.1.0'
Add the BottomNavigationView in your layout:
<android.support.design.widget.BottomNavigationView
xmlns:android="http://schemas.andro...
The web server serves the user based on the request sent by the browser but how the user will tell the browser what he/she is looking for, that's when we need URL. Every web page on the internet has got a URL that can be bookmarked, copied, shared, and saved for future reference. In single page Back...
To externalise a distributed systems configuration Spring Cloud Config provides server and client-side support needed for externalising and centralising your configuration.
To get started quickly you could use Spring Initializr to bootstrap your server. Add the Config Server dependency to automatic...
To get started quickly you could use Spring Initializr to bootstrap your client. Add the Config Client to automatically generate a project with the needed dependencies.
Or you could add the dependency manually to an existing Spring Cloud application.
<dependency>
<groupId>org.spri...