Tutorial by Examples: f

First define an ExitActivity in the AndroidManifest.xml <activity android:name="com.your_example_app.activities.ExitActivity" android:autoRemoveFromRecents="true" android:theme="@android:style/Theme.NoDisplay" /> Afterwards the ExitA...
let data = [1; 2; 3; 4; 5;] let repeating = seq {while true do yield! data} Repeating sequences can be created using a seq {} computation expression
std::function type erases down to a few operations. One of the things it requires is that the stored value be copyable. This causes problems in a few contexts, like lambdas storing unique ptrs. If you are using the std::function in a context where copying doesn't matter, like a thread pool where ...
When factors are created with defaults, levels are formed by as.character applied to the inputs and are ordered alphabetically. charvar <- rep(c("W", "n", "c"), times=c(17,20,14)) f <- factor(charvar) levels(f) # [1] "c" "n" "W" ...
A relation(or relation schema) in a given database is in first normal form, if the domain of all attributes of that relation is atomic. A domain is atomic if all the elements of that domain are considered to indivisible units. Suppose a relation employee, has attribute name, then the relation is not...
To normalize the database in the second form, there must not be any partial dependency of any column on primary key. Let's consider the following example: idnamedobsubject1Mark1-1-1981Physics2Jack2-2-1982Math2Jack2-2-1982Biology3John3-3-1983Math This table is considered to have a composite primar...
If a java library contains interfaces that should be implemented by the user (e.g. click listeners like View.IOnClickListener or callbacks), the implementing class has to inherit -- directly or indirectly -- from Java.Lang.Object or Java.Lang.Throwable. This is a common error, because the packaging ...
Step 1. In your host machine (Windows/Linux/OSX), create an empty dir my_project. Step 2. Create a file named Vagrantfile with this: Vagrant.configure("2") do |config| config.vm.box = "gbarbieru/xenial" #An Ubuntu 16.04 based image config.vm.hostname = "my_project&...
The first mistake that nearly every single programmer makes is presuming that this code will work as intended: float total = 0; for(float a = 0; a != 2; a += 0.01f) { total += a; } The novice programmer assumes that this will sum up every single number in the range 0, 0.01, 0.02, 0.03, .....
class User { String name int age } def users = [ new User(name: "Bob", age: 20), new User(name: "Tom", age: 50), new User(name: "Bill", age: 45) ] def null_value = users.find { it.age > 100 } // no over-100 found. Null null_value?.name?....
Sometimes it may be useful to have a specific asBoolean definition in your own program for some kind of objects. /** an oversimplified robot controller */ class RunController { def complexCondition int position = 0 def asBoolean() { return complexCondition(this...
Not all type erasure involves virtual inheritance, allocations, placement new, or even function pointers. What makes type erasure type erasure is that it describes a (set of) behavior(s), and takes any type that supports that behavior and wraps it up. All information that isn't in that set of beha...
The n & (n - 1) trick (see Remove rightmost set bit) is also useful to determine if an integer is a power of 2: bool power_of_2 = n && !(n & (n - 1)); Note that without the first part of the check (n &&), 0 is incorrectly considered a power of 2.
You can get it either synchronously: var docId = Todos.insert({text: 'foo'}); console.log(docId); Or asynchronously: Todos.insert({text: 'foo'}, function(error, docId){ console.log(docId); });
Simple pattern for filtering subscriptions on the server, using regexes, reactive session variables, and deps autoruns. // create our collection WordList = new Meteor.Collection("wordlist"); // and a default session variable to hold the value we're searching for Session.setDefault('...
If the Node event loop acts like a bicycle chain, the server-side collection observer is like a derailleur. It's a gearing mechanism that is going to sit on the data collection as the data comes in. It can be very performant, as all race bicycles have derailleurs. But it's also a source for breaking...
Ruby offers define_method as a private method on modules and classes for defining new instance methods. However, the 'body' of the method must be a Proc or another existing method. One way to create a method from raw string data is to use eval to create a Proc from the code: xml = <<ENDXML ...
If you want to xcopy files with specific type to a new folder keeping the current folder structure you need only to do this xcopy [SourcePath]*.mp3 [DestinationPath] /sy
The using of net.sf.jasperreports.export.xls.auto.filter property allow to add autofilter in generated xls file. <columnHeader> <band height="30" splitType="Stretch"> <staticText> <reportElement x="0" y="0" widt...
$hash = @{ city = 'Berlin' } $result = 'You should really visit {0}' -f $hash.city Write-Host $result #prints "You should really visit Berlin" Format strings can be used with the -f operator or the static [String]::Format(string format, args) .NET method.

Page 235 of 457