Tutorial by Examples

Creating an alert dialog AlertDialog.Builder builder = new AlertDialog.Builder(Context); builder.SetIcon(Resource.Drawable.Icon); builder.SetTitle(title); builder.SetMessage(message); builder.SetNeutralButton("Neutral", (evt, args) => { // code here for handling the Neutral...
Given this data User_IDCompletion_Date12016-07-2012016-07-2122016-07-2022016-07-2122016-07-22 ;with CTE as (SELECT *, ROW_NUMBER() OVER (PARTITION BY User_ID ORDER BY Completion_Date DESC) Row_Num FROM Data) SELECT * FORM CTE WHERE Row_Num <= n Us...
First of all you need to create a class which extends RecyclerView.ItemDecoration : public class SimpleBlueDivider extends RecyclerView.ItemDecoration { private Drawable mDivider; public SimpleBlueDivider(Context context) { mDivider = context.getResources().getDrawable(R.drawable.divider_b...
Refer to the tf.slice(input, begin, size) documentation for detailed information. Arguments: input: Tensor begin: starting location for each dimension of input size: number of elements for each dimension of input, using -1 includes all remaining elements Numpy-like slicing: # x has shape...
CREATE UNIQUE INDEX idx_license_id ON Person(DrivingLicenseID) WHERE DrivingLicenseID IS NOT NULL GO This schema allows for a 0..1 relationship - people can have zero or one driving licenses and each license can only belong to one person
Some functions only work on a certain type of argument: function foo(tab) return tab.bar end --> returns nil if tab has no field bar, which is acceptable --> returns 'attempt to index a number value' if tab is, for example, 3 --> which is unacceptable function kungfoo(tab) ...
It is now a best-practice to use Vector instead of List because the implementations have better performance Performance characteristics can be found here. Vector can be used wherever List is used. List creation List[Int]() // Declares an empty list of type Int List.empty[Int] // U...
Note that this deals with the creation of a collection of type Map, which is distinct from the map method. Map Creation Map[String, Int]() val m1: Map[String, Int] = Map() val m2: String Map Int = Map() A map can be considered a collection of tuples for most operations, where the first e...
A counter using an FPGA style flip-flop initialisation: module counter( input clk, output reg[7:0] count ) initial count = 0; always @ (posedge clk) begin count <= count + 1'b1; end A counter implemented using asynchronous resets suitable for ASIC synthesis: module counter...
A non-blocking assignment (<=) is used for assignment inside edge-sensitive always blocks. Within a block, the new values are not visible until the entire block has been processed. For example: module flip( input clk, input reset ) reg f1; reg f2; always @ (posedge clk) begin ...
A 2-tuple or a 3-tuple represent a group of related items. (Points in 2D space, RGB values of a color, etc.) A 1-tuple is not very useful since it could easily be replaced with a single int. A 0-tuple seems even more useless since it contains absolutely nothing. Yet it has properties that make it v...
An Enum instance can be created by parsing a string representation of the Enum. Module Module1 Enum Size Small Medium Large End Enum Sub Main() Dim shirtSize As Size = DirectCast([Enum].Parse(GetType(Size), "Medium"), Size) ...
Sitecore ships with a set of standard indexes pre-configured which you can extend, or you can define your own. Of the pre-configured, sitecore_master_index & sitecore_web_index are of most interest for your site search. These are the predefined indexes for all of your Sitecore items in the tree ...
Demo HTML <script type="x-template" id="form-template"> <label>{{inputLabel}} :</label> <input type="text" v-model="name" /> </script> <div id="app"> <h2>{{appName}}</h2> <form-co...
//Swift imageView.tintColor = UIColor.redColor() imageView.image = imageView.image?.imageWithRenderingMode(.AlwaysTemplate) //Swift 3 imageView.tintColor = UIColor.red imageView.image = imageView.image?.withRenderingMode(.alwaysTemplate) //Objective-C imageView.tintColor = [UIColor redCol...
The Scala compiler prefixes every argument in the parameter list by default with val. This means that, by default, case classes are immutable. Each parameter is given an accessor method, but there are no mutator methods. For example: case class Foo(i: Int) val fooInstance = Foo(1) val j = fooIn...
We start off with $db, an instance of the PDO class. After executing a query we often want to determine the number of rows that have been affected by it. The rowCount() method of the PDOStatement will work nicely: $query = $db->query("DELETE FROM table WHERE name = 'John'"); $count = ...
All you need is a variable of type IHostingEnvironment: get environment name: env.EnvironmentName for predefined Development, Staging, Production environments the best way is to use extension methods from HostingEnvironmentExtensions class env.IsDevelopment() env.IsStaging() ...
A true relational database must go beyond throwing data into a few tables and writing some SQL statements to pull that data out. At best a badly designed table structure will slow the execution of queries and could make it impossible for the database to function as intended. A database table shoul...
Apply will be used when when table valued function in the right expression. create a Department table to hold information about departments. Then create an Employee table which hold information about the employees. Please note, each employee belongs to a department, hence the Employee table has ref...

Page 314 of 1336