Tutorial by Examples

Intercepted method: public class ExampleService implements Example { @MyAnnotation public doHomework() { System.out.println("working"); } } Annotation: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface MyAnnotation {} ...
These three map functions are equivalent, so use the variation that your team finds most readable. val numberNames = Map(1 -> "One", 2 -> "Two", 3 -> "Three") // 1. No extraction numberNames.map(it => s"${it._1} is written ${it._2}" ) // 2....
Suppose we have an array: +-------+-----+-----+-----+-----+-----+-----+ | Index | 0 | 1 | 2 | 3 | 4 | 5 | +-------+-----+-----+-----+-----+-----+-----+ | Value | -1 | 3 | 4 | 0 | 2 | 1 | +-------+-----+-----+-----+-----+-----+-----+ We want to perform some query on thi...
Let's say, we have an array: Item = {-1, 0, 3, 6}. We want to construct SegmentTree array to find out the minimum value in a given range. Our segment tree will look like: The numbers below the nodes show the indices of each values that we'll store in our SegmentTree array. We can see that, to sto...
The procedure to perform a RMQ is already shown in introduction. The pseudo-code for checking Range Minimum Query will be: Procedure RangeMinimumQuery(SegmentTree, qLow, qHigh, low, high, position): if qLow <= low and qHigh >= high //Total Overlap Return SegmentTree[position] el...
Import libraries (language dependency: python 2.7) import tensorflow as tf import numpy as np from sklearn.datasets import fetch_mldata from sklearn.model_selection import train_test_split load data, prepare data mnist = fetch_mldata('MNIST original', data_home='./') print "MNIST data,...
There are many online video tutorials for maya, python and pyqt. Which will give you access to some in depth knowledge of maya and python programming in maya. Some are covered with pyqt also. Here is some and feel free to add more here. https://www.udemy.com/python-for-maya/learn/v4/overview By D...
Collection Operators can be used in a KVC key path to perform an operation on a “collection-type” property (i.e. NSArray, NSSet and similar). For example, a common operation to perform is to count the objects in a collection. To achieve this, you use the @count collection operator: self.array = @[@...
Most of the time we like to get the total number of occurrence of a column value in a table for example: TABLE NAME : REPORTS ReportNameReportPriceTest10.00 $Test10.00 $Test10.00 $Test 211.00 $Test10.00 $Test 314.00 $Test 314.00 $Test 4100.00 $ SELECT ReportName AS REPORT ...
public class SimpleLoginView extends CustomComponent implements View, Button.ClickListener { public static final String NAME = "login"; private final TextField user; private final PasswordField password; private final Button loginButton; public SimpleLoginView() { setS...
public class SimpleLoginUI extends UI { @Override protected void init(VaadinRequest request) { // // Create a new instance of the navigator. The navigator will attach // itself automatically to this view. // new Navigator(this, this); // // The initial log ...
public class SimpleLoginMainView extends CustomComponent implements View { public static final String NAME = ""; Label text = new Label(); Button logout = new Button("Logout", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { ...
int[string] numbers = ["a" : 10, "b" : 20]; assert("a" in numbers); assert("b" in numbers); assert("c" in numbers);
@Theme("mobiletheme") @Widgetset("com.example.myapp.MyAppWidgetSet") @Title("My Mobile App") public class SimplePhoneUI extends UI { @Override protected void init(VaadinRequest request) { // Define a view class MyView extends NavigationView { ...
In C++, code must be declared or defined before usage. For example, the following produces a compile time error: int main() { foo(2); // error: foo is called, but has not yet been declared } void foo(int x) // this later definition is not known in main { } There are two ways to resolve...
This example will guide you how to get playlist data using the YouTube Data API on Android. SHA-1 fingerprint First you need to get an SHA-1 fingerprint for your machine. There are various methods for retrieving it. You can choose any method provided in this Q&A. Google API console and YouTub...
Here a Turtle Graphics Ninja Twist: import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposit...
The following Codes can be found from Weka course Given iris.arff is loaded in weka, inside Weka Explorer's R console or Weka KnowledgeFlow's R Scripting, you can play with the following codes to make beautiful plots: library(ggplot2) ggplot(rdata, aes(x = petallength)) + geom_density() ...
Implement ICloneable in a class with a twist. Expose a public type safe Clone() and implement object Clone() privately. public class Person : ICloneable { // Contents of class public string Name { get; set; } public int Age { get; set; } // Constructor public Person(string...
The implementation of ICloneable for a struct is not generally needed because structs do a memberwise copy with the assignment operator =. But the design might require the implementation of another interface that inherits from ICloneable. Another reason would be if the struct contains a reference t...

Page 1031 of 1336