Tutorial by Examples: ble

Extension methods enable you to simplify your interface definitions by only including core required functionality in the interface itself and allowing you to define convenience methods and overloads as extension methods. Interfaces with fewer methods are easier to implement in new classes. Keeping o...
In the most basic form, it is possible to select a single variable from a table by calling the object's get_var method passing in an SQL query. global $wpdb; $user = $wpdb->get_var( "SELECT ID FROM $wpdb->users WHERE user_email='[email protected]'" ); It is very important to note that...
By default, the implicit operator() of a lambda is const. This disallows performing non-const operations on the lambda. In order to allow modifying members, a lambda may be marked mutable, which makes the implicit operator() non-const: int a = 0; auto bad_counter = [a] { return a++; // er...
If you are looking to run a file, such as an executable, use child_process.execFile. Instead of spawning a shell like child_process.exec would, it will directly create a new process, which is slightly more efficient than running a command. The function can be used like so: const execFile = require(...
You can loop over any iterable by using the standard for-loop: val list = listOf("Hello", "World", "!") for(str in list) { print(str) } Lots of things in Kotlin are iterable, like number ranges: for(i in 0..9) { print(i) } If you need an index while...
Observables are broadly categorised as Hot or Cold, depending on their emission behaviour. A Cold Observable is one which starts emitting upon request(subscription), whereas a Hot Observable is one that emits regardless of subscriptions. Cold Observable /* Demonstration of a Cold Observable */ Ob...
A section containing data arranged in rows and columns. The table role is intended for tabular containers which are not interactive. <table role="table"> <thead> <!-- etc --> </thead> <tbody> <!-- etc --> </tbody> </table...
If you want to see the schema information of your table, you can use one of the following: SHOW CREATE TABLE child; -- Option 1 CREATE TABLE `child` ( `id` int(11) NOT NULL AUTO_INCREMENT, `fullName` varchar(100) NOT NULL, `myParent` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `momm...
NOTE: In most cases, it is better to use a UIButton instead of making a UILabel you can tap on. Only use this example, if you are sure, that you don't want to use a UIButton for some reason. Create label Enable user interaction Add UITapGestureRecognizer The key to create a clickable UIL...
// You need a writable database to update a row final SQLiteDatabase database = openHelper.getWritableDatabase(); // Create a ContentValues instance which contains the up to date data for each column // Unlike when inserting data you need to specify the value for the PRIMARY KEY column as well ...
Some basic types and classes in Java are fundamentally mutable. For example, all array types are mutable, and so are classes like java.util.Data. This can be awkward in situations where an immutable type is mandated. One way to deal with this is to create an immutable wrapper for the mutable type...
static int Sum(int a, int b) { return a + b; } static int Multiplication(int a, int b) { return a * b; } static void Main(string[] args) { Func<int, int, int> method = Sum; // method points to the Sum method // that retuns 1 int variable and takes 2 int vari...
An immutable object is an object whose state cannot be changed. An immutable class is a class whose instances are immutable by design, and implementation. The Java class which is most commonly presented as an example of immutability is java.lang.String. The following is a stereotypical example: ...
Specially useful for has_and_belongs_to_many relation, you can manually create a join table using the create_table method. Suppose you have two models Tags and Proyects, and you'd like to associate them using a has_and_belongs_to_many relation. You need a join table to associate instances of both c...
// RawRepresentable has an associatedType RawValue. // For this struct, we will make the compiler infer the type // by implementing the rawValue variable with a type of String // // Compiler infers RawValue = String without needing typealias // struct NotificationName: RawRepresentable { ...
Sometimes we need to change type from Collection<T?> to Collections<T>. In that case, filterNotNull is our solution. val a: List<Int?> = listOf(1, 2, 3, null) val b: List<Int> = a.filterNotNull()
3 You can use rem defined by the font-size of your html tag to style elements by setting their font-size to a value of rem and use em inside the element to create elements that scale with your global font-size. HTML: <input type="button" value="Button"> <input type=...
This example uses a search controller to filter the cells in a table view controller. The search bar is placed inside the header view of the table view. The table view content is offset with the same height as the search bar so that the search bar is hidden at first. Upon scrolling up past the top e...
Sometimes you just need a diff to apply using patch. The regular git --diff does not work. Try this instead: git diff --no-prefix > some_file.patch Then somewhere else you can reverse it: patch -p0 < some_file.patch
Picasso.with(context) .load(uri) .networkPolicy(NetworkPolicy.NO_CACHE) .memoryPolicy(MemoryPolicy.NO_CACHE) .placeholder(R.drawable.placeholder) .into(imageView);

Page 17 of 62