Tutorial by Examples: di

When a base class provides a set of overloaded functions, and a derived class adds another overload to the set, this hides all of the overloads provided by the base class. struct HiddenBase { void f(int) { std::cout << "int" << std::endl; } void f(bool) { std::cout &...
Unity networking provides the High Level API (HLA) to handle network communications abstracting from low level implementations. In this example we will see how to create a Server that can communicate with one or multiple clients. The HLA allows us to easily serialize a class and send objects of ...
If you are adding new rows and updating existing data. You need two additional parameters: --check-column : A column name that should be checked for newly appended and updated data. date, time, datetime and timestamp are suitable data types for this column. --last-value : The last value that su...
Rust's coherence rule requires that either the trait or the type for which you are implementing the trait must be defined in the same crate as the impl, so it is not possible to implement Serialize and Deserialize for a type in a different crate directly. The newtype pattern and Deref coercion provi...
ExecutorService ExecutorService executor = Executors.newFixedThreadPool(50); It is simple and easy to use. It hides low level details of ThreadPoolExecutor. I prefer this one when number of Callable/Runnable tasks are small in number and piling of tasks in unbounded queue does not increase m...
Executors returns different type of ThreadPools catering to specific need. public static ExecutorService newSingleThreadExecutor() Creates an Executor that uses a single worker thread operating off an unbounded queue There is a difference between newFixedThreadPool(1) and newSingleThreadE...
You can realize a modal bottom sheets using a BottomSheetDialogFragment. The BottomSheetDialogFragment is a modal bottom sheet. This is a version of DialogFragment that shows a bottom sheet using BottomSheetDialog instead of a floating dialog. Just define the fragment: public class MyBottomSheet...
The BottomSheetDialog is a dialog styled as a bottom sheet Just use: //Create a new BottomSheetDialog BottomSheetDialog dialog = new BottomSheetDialog(context); //Inflate the layout R.layout.my_dialog_layout dialog.setContentView(R.layout.my_dialog_layout); //Show the dialog dialog.show(); ...
C# 7.0 adds accessors, constructors and finalizers to the list of things that can have expression bodies: class Person { private static ConcurrentDictionary<int, string> names = new ConcurrentDictionary<int, string>(); private int id = GetId(); public Person(string n...
This is useful if you use rust in the backend and elm on the front end enum Complex{ Message(String), Size(u64) } let c1 = Complex::Message("hi"); let c2 = Complex::Size(1024u64); The encoded Json from rust will be: c1: {"variant": "Message", ...
This is a screenshot of a video playing. You see a normal 16:9 video like you would expect to see in any modern video solution. This - the aspect ratio that the viewer sees - is what is called the display aspect ratio or DAR. From the illustrated parameters, we see that DAR = 1280:720 = 16:9 = 1....
The SwipeDismissBehavior works on any View and implements the functionality of swipe to dismiss in our layouts with a CoordinatorLayout. Just use: final SwipeDismissBehavior<MyView> swipe = new SwipeDismissBehavior(); //Sets the swipe direction for this behavior. ...
Smack (Java) Using Smack 4.1 It is recommended to include Smack as Maven dependency in your project (e.g. by using gradle or Maven). Otherwhise the following Smack artifacts/jars have to be added manually to the classpath: smack-core, smack-extensions, smack-experimental, smack-im, smnack-tcp,...
This example shows how JNDI works in RMI. It has two roles: to provide the server with a bind/unbind/rebind API to the RMI Registry to provide the client with a lookup/list API to the RMI Registry. The RMI Registry is part of RMI, not JNDI. To make this simple, we will use java.rmi.registry....
Often it is useful to be able to load all of the profiles in one or more assemblies into a configuration. AutoMapper provides the method AddProfiles method, which has several overloads that allow profiles to be loaded by passing the Assembly, specifying the assembly name, or specifying a type contai...
@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToMany(mappedBy = "bar") private List<FooBar> bars; } @Entity @Table(name="BAR") public class Bar { private UUID barId; @OneToMany(mappedBy = "f...
@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToMany @JoinTable(name="FOO_BAR", joinColumns = @JoinColumn(name="fooId"), inverseJoinColumns = @JoinColumn(name="barId")) private List<Bar&g...
@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToMany(mappedBy = "bar") private List<Bar> bars; } @Entity @Table(name="BAR") public class Bar { private UUID barId; @ManyToOne @JoinColumn(nam...
@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToOne(cascade = CascadeType.ALL) @JoinColumn(name = "barId") private Bar bar; } @Entity @Table(name="BAR") public class Bar { private UUID barId; ...
@Entity @Table(name="FOO") public class Foo { private UUID fooId; @OneToMany @JoinTable(name="FOO_BAR", joinColumns = @JoinColumn(name="fooId"), inverseJoinColumns = @JoinColumn(name="barId", unique=true)) private ...

Page 100 of 164