Tutorial by Examples: a

Code Group group = new Group(); group.setId(1); group.setName("Ke"); User user1 = new User(); user1.setId(2); user1.setName("Liu"); User user2 = new User(); user2.setId(3); user2.setName("Yue"); ...
After installing perforce and setup your workspace through p4v, you could set up your workspace in Windows cmd. The command you need is: p4 set Set your server p4 set P4PORT= xx.xxx.xx.xxx:xxxxx Set your user name p4 set P4USER=username Set your password In terms of setting your passwo...
final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); restClient = factory.createWithBasicHttpAuthentication(URI.create(JIRA_SERVER), JIRA_LOGIN, JIRA_PASSWORD); getFilteredIssues("project = TestProject"); public Iterable<Issue> getFilteredIs...
Project build.gradle allprojects { repositories { jcenter() // Add this if you use Gradle 4.0+ google() // Add this if you use Gradle < 4.0 maven { url 'https://maven.google.com' } } } ext { archVersion = '1.0.0-alpha5' } Applic...
Extend your activity from this activity public abstract class BaseCompatLifecycleActivity extends AppCompatActivity implements LifecycleRegistryOwner { // We need this class, because LifecycleActivity extends FragmentActivity not AppCompatActivity @NonNull private final LifecycleRe...
public class BaseViewModel extends ViewModel { private static final int TAG_SEGMENT_INDEX = 2; private static final int VIDEOS_LIMIT = 100; // We save input params here private final MutableLiveData<Pair<String, String>> urlWithReferrerLiveData = new MutableLiveData...
You may write custom LiveData, if you need custom logic. Don't write custom class, if you only need to transform data (use Transformations class) public class LocationLiveData extends LiveData<Location> { private LocationManager locationManager; private LocationListener liste...
Each UI component lifecycle changed as shown at image. You may create component, that will be notified on lifecycle state change: public class MyLocationListener implements LifecycleObserver { private boolean enabled = false; private Lifecycle lifecycle; public MyLocationListener(...
Sometime you will need to know, with 2 dates objects, if there are corresponding to the same date, or find which date is after the other. In Go, there is 4 way to compare dates: date1 == date2, returns true when the 2 are the same moment date1 != date2, returns true when the 2 are different mom...
Handy method to initialise SolrJ client based on configuration properties; private void initSolrClient() { if (conf.kerberos().isEnabled()) { System.setProperty("java.security.auth.login.config", conf.kerberos().confPath()); HttpClientUtil.addConfigurer(new Krb5Http...
def append_to_csv(input_string): with open("fileName.csv", "a") as csv_file: csv_file.write(input_row + "\n")
PSR-4 is an accepted recommendation that outlines the standard for autoloading classes via filenames. This recommendation is recommended as the alternative to the earlier (and now deprecated) PSR-0. The fully qualified class name should match the following requirement: \<NamespaceName>(\&lt...
PSR-1 is an accepted recommendation and outlines a basic standard recommendation for how code should be written. It outlines naming convetions for classes, methods and constants. It makes adopting PSR-0 or PSR-4 recommendations a requirement. It indicates which PHP tags to use: <?php and &lt...
PSR-8 is a spoof PSR (currently in Draft) proposed by Larry Garfield as an April Fools joke on 1 April 2014. The draft outlines how to define an interface to make an object Huggable. Excert from the code outline: <?php namespace Psr\Hug; /** * Defines a huggable object. * * A hugga...
1 2 3 <public publicId="-//OASIS//DTD DocBook XML V4.5//EN" 4 uri="docbook45/docbookx.dtd"/> <system systemId="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" 5 uri="docbook45/docbookx.dtd"/> <system ...
datepicker-overview-example.html: <md-input-container> <input mdInput [mdDatepicker]="picker" [(ngModel)]="date" placeholder="Choose a date"> <button mdSuffix [mdDatepickerToggle]="picker"></button&gt...
datepicker-overview-example.html: <md-input-container> <input mdInput [mdDatepicker]="picker" placeholder="Choose a date" [(ngModel)]="value"> <button mdSuffix [mdDatepickerToggle]="picker"></button> </md-input-container&...
This example also includes the use of properties: min max startAt startView touchUi datepicker-overview-example.html: <h2>Options</h2> <p> <md-checkbox [(ngModel)]="touch">Use touch UI</md-checkbox> <md-checkbox [(ngModel)]="filterOdd...
Most of the times, validation attributes are use inside frameworks (such as ASP.NET). Those frameworks take care of executing the validation attributes. But what if you want to execute validation attributes manually? Just use the Validator class (no reflection needed). Validation Context Any valid...
This example requires MdDialogRef and MD_DIALOG_DATA. Please import them in the component module. import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material'; input-overview-example.html: <md-input-container> <input mdInput [(ngModel)]="id" ...

Page 1090 of 1099