Tutorial by Examples: comp

db.people.createIndex({name: 1, age: -1}) This creates an index on multiple fields, in this case on the name and age fields. It will be ascending in name and descending in age. In this type of index, the sort order is relevant, because it will determine whether the index can support a sort opera...
The NVIDIA installation guide ends with running the sample programs to verify your installation of the CUDA Toolkit, but doesn't explicitly state how. First check all the prerequisites. Check the default CUDA directory for the sample programs. If it is not present, it can be downloaded from the offi...
There are times when an include file has to generate different output from the preprocessor depending on whether the compiler is a C compiler or a C++ compiler due to language differences. For example a function or other external is defined in a C source file but is used in a C++ source file. Since...
Enabling gzip compression can reduce the size of the transferred response by up to 90%, which can significantly reduce the amount of time to download the resource, reduce data usage for the client, and improve the time to first render of your pages. — PageSpeed Insights Compression can be ena...
installing npm install web-component-tester --save-dev setting up wct.conf.js module.exports = { verbose: true, plugins: { local: { browsers: ['chrome'] } } }; running node node_modules/web-component-tester/bin/wct test/index.html <html...
Computed observables are functions that can "watch" or "react" to other observables on the view model. The following example shows how you would display the total number of users and the average age. Note: The example below can also make use of pureComputed() (introduced in v3....
Let's look at a sample of logging which you can see in many programs: public class LoggingComplex { private static final Logger logger = Logger.getLogger(LoggingComplex.class.getName()); private int total = 50, orders = 20; private String username = "Bob";...
Option Compare Binary Binary comparison makes all checks for string equality within a module/class case sensitive. Technically, with this option, string comparisons are performed using sort order of the binary representations of each character. A < B < E < Z < a < b < e < z ...
CSS div.needle { margin: 100px; height: 150px; width: 150px; transform: rotateY(85deg) rotateZ(45deg); /* presentational */ background-image: linear-gradient(to top left, #555 0%, #555 40%, #444 50%, #333 97%); box-shadow: inset 6px 6px 22px 8px #272727; } HTML <div c...
A very basic docker-compose.yml looks like this: version: '2' services: hello_world: image: ubuntu command: [/bin/echo, 'Hello world'] This file is making it so that there's a hello_world service, that's initialized from the ubuntu:latest image and that, when it's run, it just runs...
sudo apt-add-repository ppa:brightbox/ruby-ng Hit Enter to confirm sudo apt-get update Then you can install your ruby version of choice (the ppa supports ruby2.0 ruby2.1 ruby2.2 ruby2.3 and legacy versions ruby1.8 ruby1.9.1) Don't forget to include the respective -dev package for your version. Ot...
There are several ways to compile your app. You can use the simulator/emulator, deploy it to your device or create store apk's/ipa's. There is also a live test tool (TiShadow) which saves you a lot of time waiting for the compiler. cli way # android to device ti build -p android -T device # a...
defmodule ATest do use ExUnit.Case [{1, 2, 3}, {10, 20, 40}, {100, 200, 300}] |> Enum.each(fn {a, b, c} -> test "#{a} + #{b} = #{c}" do assert unquote(a) + unquote(b) = unquote(c) end end) end Output: . 1) test 10 + 20 = 40 (Test.Test) t...
C++17 namespace a { namespace b { template<class T> struct qualifies : std::false_type {}; } } namespace other { struct bob {}; } namespace a::b { template<> struct qualifies<::other::bob> : std::true_type {}; } You can enter both the a and b n...
Compare two Strings ignoring case: "School".equalsIgnoreCase("school"); // true Don't use text1.toLowerCase().equals(text2.toLowerCase()); Languages have different rules for converting upper and lower case. A 'I' would be converted to 'i' in English. But in Turkish a 'I' ...
List comprehensions are a syntactic construct to create a list based on existing lists. In erlang a list comprehension has the form [Expr || Qualifier1, ..., QualifierN]. Where qualifiers are either generators Pattern <- ListExpr or filter like integer(X) evaluating to either true or false. Th...
If an array happens to have one or more nil elements and these need to be removed, the Array#compact or Array#compact! methods can be used, as below. array = [ 1, nil, 'hello', nil, '5', 33] array.compact # => [ 1, 'hello', '5', 33] #notice that the method returns a new copy of the array w...
Arrays can be compared for equality with the aptly named isEqualToArray: method, which returns YES when both arrays have the same number of elements and every pair pass an isEqual: comparison. NSArray *germanMakes = @[@"Mercedes-Benz", @"BMW", @"Porsche", ...
A compound literal is an unnamed object which is created in the scope where is defined. The concept was first introduced in C99 standard. An example for compound literal is Examples from C standard, C11-§6.5.2.5/9: int *p = (int [2]){ 2, 4 }; p is initialized to the address of the first ele...
A component can be registered either globally or locally (bind to another specific component). var Child = Vue.extend({ // ... }) var Parent = Vue.extend({ template: '...', components: { 'my-component': Child } }) Thiw new component () will only be available in...

Page 13 of 34