Tutorial by Examples: c

C++11 introduces what are known as scoped enums. These are enumerations whose members must be qualified with enumname::membername. Scoped enums are declared using the enum class syntax. For example, to store the colors in a rainbow: enum class rainbow { RED, ORANGE, YELLOW, GREE...
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...
Pattern matching extensions for C# enable many of the benefits of pattern matching from functional languages, but in a way that smoothly integrates with the feel of the underlying language switch expression Pattern matching extends the switch statement to switch on types: class Geometry {} cl...
The Timeline object allows you to get the execution time for each node in the graph: you use a classic sess.run() but also specify the optional arguments options and run_metadata you then create a Timeline object with the run_metadata.step_stats data Here is an example program that measures...
How do you get the number of Debit and Credit transactions? One way to do it is by using count() function as below. > db.transactions.count({cr_dr : "D"}); or > db.transactions.find({cr_dr : "D"}).length(); But what if you do not know the possible values of cr_dr up...
Navigation Shortcuts Go to class Ctrl+N Go to file Ctrl + Shift + N Navigate open tabs ALT + Left-Arrow; ALT + Right-Arrow Lookup recent files CTRL + E Go to line CTRL + G Navigate to last ed...
A model represents some data object in an application. For example you can have a model such as: Fruit, Car, Building, etc. in your application. Models are normally used by stores. Here is example how you would define a new model class. e.g. Ext.define('MyApp.model.Person', { extend: 'Ext.data...
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 two ways to setup the Apache Flex SDK. You can use the provided Apache Flex SDK Installer, an Adobe AIR application that automates the process (on Windows or OS X/macOS). Or you can install it manually which obviously requires a greater comfort with your platform but provides more flexibi...
public class Sheep { private String name; private int weight; public Sheep(String name, int weight) { this.name = name; this.weight = weight; } public static Sheep newInstance(Sheep other); return new Sheep(other.name, other.wei...
The tf.py_func(func, inp, Tout) operator creates a TensorFlow operation that calls a Python function, func on a list of tensors inp. See the documentation for tf.py_func(func, inp, Tout). Warning: The tf.py_func() operation will only run on CPU. If you are using distributed TensorFlow, the tf.py_f...
The tf.py_func() operator enables you to run arbitrary Python code in the middle of a TensorFlow graph. It is particularly convenient for wrapping custom NumPy operators for which no equivalent TensorFlow operator (yet) exists. Adding tf.py_func() is an alternative to using sess.run() calls inside t...
Some LINQ methods return a query object. This object does not hold the results of the query; instead, it has all the information needed to generate those results: var list = new List<int>() {1, 2, 3, 4, 5}; var query = list.Select(x => { Console.Write($"{x} "); return ...
To show and hide a FloatingActionButton with the default animation, just call the methods show() and hide(). It's good practice to keep a FloatingActionButton in the Activity layout instead of putting it in a Fragment, this allows the default animations to work when showing and hiding. Here is an ...
CREATE DATABASE LINK dblink_name CONNECT TO remote_username IDENTIFIED BY remote_password USING 'tns_service_name'; The remote DB will then be accessible in the following way: SELECT * FROM MY_TABLE@dblink_name; To test a database link connection without needing to know any of the objec...
In general, functions that operate on other functions, either by taking them as arguments or by returning them (or both), are called higher-order functions. A higher-order function is a function that can take another function as an argument. You are using higher-order functions when passing callbac...
:g/Hello/d Will delete every line containing the text "Hello". Important note: This is not the normal mode command d, this is the ex command :d. You can use the global command to apply normal mode keystrokes instead of ex commands by prepending normal or norm to the command. For exampl...
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController include OmniConcern %w[facebook twitter gplus linkedin].each do |meth| define_method(meth) do create end end end Note: In the part “%w[facebook twitter gplus linkedin]”, you should list ...
module OmniConcern extend ActiveSupport::Concern def create auth_params = request.env["omniauth.auth"] provider = AuthenticationProvider.get_provider_name(auth_params.try(:provider)).first authentication = provider.user_authentications.where(uid: auth_params.uid).first...
class CreateAuthenticationProviders < ActiveRecord::Migration def change create_table "authentication_providers", :force => true do |t| t.string "name" t.datetime "created_at", :null => false ...

Page 320 of 826