When the select statement is executed, it displays the given items prefixed with a number and then displays the PS3 prompt:
export PS3=" To choose your language type the preceding number : "
select lang in EN CA FR DE; do
# check input here until valid.
break
done
PS4 is displayes when bash is in debugging mode.
#!/usr/bin/env bash
# switch on debugging
set -x
# define a stupid_func
stupid_func(){
echo I am line 1 of stupid_func
echo I am line 2 of stupid_func
}
# setting the PS4 "DEBUG" prompt
export PS4='\nDEBUG level:$SHLVL ...
When in the SBT console, to list all definable settings for a project:
settings
Or, to get a subproject's (for example, named webapp) settings:
project webapp
settings
The first line above navigates into the specific subproject.
To show the value of a specific setting (for instance, organi...
All that is needed to define a task is a declaration of it's type and a description:
lazy val exampleTask = taskKey[Unit]("An example task that will return no value.")
Because Unit is the type, this task is composed entirely of side-effects. Once defined, to implement actions:
example...
2013
SharePoint 2013 and newer versions are 64-bit only and so the assembly/program needs to be also built for 64-bit processor.
Right after your project is created it is necessary to swich the Platform target from Any CPU to x64 otherwise error will occure.
using System;
using Microsoft.Share...
Using async initialization is a recommended way for application development. It uses the OpenCV Manager to access OpenCV libraries externally installed in the target system.
Code snippet implementing the async initialization:
public class MainActivity extends Activity implements CvCameraViewListen...
According to this approach all OpenCV binaries are included into your application package. It is designed mostly for development and debugging purposes. This approach is deprecated for the production code, async initialization is recommended.
If your application project doesn’t have a JNI part, jus...
This example covers some advanced features and use-cases for Exceptions.
Examining the callstack programmatically
Java SE 1.4
The primary use of exception stacktraces is to provide information about an application error and its context so that the programmer can diagnose and fix the problem. Som...
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...
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 Handler = () -> Void
typealias Handler = () -> ()
This block creates a type alias that works as a Void to Void function (takes in no parameters and returns nothing).
Here is a usage example:
var func: Handler?
func = {}
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,
&...
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/${...
This plugin is mandatory to make Gerrit able to receive message from other services. As an example, it has to be install to use Sonar Gerrit plugin
Install jar file under plugins folder
Default configuration is sufficient
Encapsulating an OpenGL object in C++98/03 requires obeying the C++ rule of 3. This means adding a copy constructor, copy assignment operator, and destructor.
However, copy constructors should logically copy the object. And copying an OpenGL object is a non-trivial undertaking. Equally importantly,...