Due to way that the float type is represented in computer memory, results of operations using this type can be inaccurate - some values are stored as approximations. Good examples of this are monetary calculations.
If high precision is necessary, other types should be used. e.g. Java 7 provides Big...
Display a two dimensional (2D) array on the axes.
import numpy as np
from matplotlib.pyplot import imshow, show, colorbar
image = np.random.rand(4,4)
imshow(image)
colorbar()
show()
Swift
import Contacts
// Creating a mutable object to add to the contact
let contact = CNMutableContact()
contact.imageData = NSData() // The profile picture as a NSData object
contact.givenName = "John"
contact.familyName = "Appleseed"
let homeEmail = CNLabele...
The whole point of MVVM is to separate layers containing logic from the view layer.
On Android we can use the DataBinding Library to help us with this and make most of our logic Unit-testable without worrying about Android dependencies.
In this example I'll show the central components for a stupid...
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:
...
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)
...
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...
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 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...
Before the Julia 0.5, there is no way to use conditions inside the array comprehensions. But, it is no longer true. In Julia 0.5 we can use the conditions inside conditions like the following:
julia> [x^2 for x in 0:9 if x > 5]
4-element Array{Int64,1}:
36
49
64
81
Source of the ...
Using ls() as a filter can sometimes provide produce odd results. If you accidentally forget to pass a filter argument and call ls() with no arguments, you will get a list of every node in the Maya scene:
cmds.ls()
# [u'time1', u'sequenceManager1', u'hardwareRenderingGlobals', u'renderPartition...
It is common to use a background Thread for doing network operations or long running tasks, and then update the UI with the results when needed.
This poses a problem, as only the main thread can update the UI.
The solution is to use the runOnUiThread() method, as it allows you to initiate code exe...
Team Foundation Server (commonly abbreviated to TFS) is a Microsoft product that provides source code management (either via Team Foundation Version Control or Git), reporting, requirements management, project management (for both agile software development and waterfall teams), automated builds and...