In your sign-in activity's onCreate method, configure Google Sign-In to request the user data required by your app.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
create a GoogleApiClient object wi...
Most of the web applications use the session object to store some important information. This examples show how you can test such application using Flask-Testing. Full working example is also available on github.
So first install Flask-Testing in your virtualenv
pip install flask_testing
To be ...
With the virtual hard drive just created, boot the virtual machine with the android-x86 image in the optical drive.
Once you boot, you can see the grub menu of the Live CD
Choose the Debug Mode Option, then you should see the shell prompt. This is a busybox shell. You can get more shell by swi...
An example of implementation which give a possibility to detect if user single or double tap on UITableViewCell.
override func viewDidLoad() {
viewDidLoad()
let doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(sender:)))
double...
An example of implementation UITableView which allows to detect if cell has been tapped single or double time.
override func viewDidLoad() {
viewDidLoad()
let doubleTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTap(sender:)))
doubleTa...
To create a background with a gradient you can use the CAGradientLayer class:
Swift 3.1:
func createGradient() {
let caLayer = CAGradientLayer()
caLayer.colors = [UIColor.white, UIColor.green, UIColor.blue]
caLayer.locations = [0, 0.5, 1]
caLayer.bounds = self.bounds
self...
To add a custom image for the thumb of the slider, simply call the setThumbImage method with your custom image:
Swift 3.1:
let slider = UISlider()
let thumbImage = UIImage
slider.setThumbImage(thumbImage, for: .normal)
multiply-square-matrix-parallel(A, B)
n = A.lines
C = Matrix(n,n) //create a new matrix n*n
parallel for i = 1 to n
parallel for j = 1 to n
C[i][j] = 0
pour k = 1 to n
C[i][j] = C[i][j] + A[i][k]*B[k][j]
return C
matrix-vector(A,x)
n = A.lines
y = Vector(n) //create a new vector of length n
parallel for i = 1 to n
y[i] = 0
parallel for i = 1 to n
for j = 1 to n
y[i] = y[i] + A[i][j]*x[j]
return y
A is an array and p and q indexes of the array such as you gonna sort the sub-array A[p..r]. B is a sub-array which will be populated by the sort.
A call to p-merge-sort(A,p,r,B,s) sorts elements from A[p..r] and put them in B[s..s+r-p].
p-merge-sort(A,p,r,B,s)
n = r-p+1
if n==1
...
Suppose we have a simple class with validation annotations
public class UserDTO {
@NotEmpty
private String name;
@Min(18)
private int age;
//getters/setters
}
A controller to check the UserDTO validity.
@RestController
public class ValidationController {
@Reque...
In following example we will create table movies with AWS Ruby SDK v2.
Here, each Movie as one unique Partition Key as id, and Range Key year. Apart from this we want to be able to query movies with their name, hence we will create a Global Secondary Index (GSI) name-year-index with name as Hash Ke...
This example show you how you add new sounds to your MOD and play them. First of all you need a sound file which has the format *.ogg. Any other format is not allowed by the Minecraft application and will be rejected.
The soundfile has the name: sound1.ogg
Put the sound file under the following pa...
Ex1:-
let str1 = 'stackoverflow';
let str2 = 'flowerovstack';
These strings are anagrams.
// Create Hash from str1 and increase one count.
hashMap = {
s : 1,
t : 1,
a : 1,
c : 1,
k : 1,
o : 2,
v : 1,
e : 1,
r : 1,
f : 1,
l : 1,
w : 1...