To detect the endian of the device
var isLittleEndian = true;
(()=>{
var buf = new ArrayBuffer(4);
var buf8 = new Uint8ClampedArray(buf);
var data = new Uint32Array(buf);
data[0] = 0x0F000000;
if(buf8[0] === 0x0f){
isLittleEndian = false;
}
})();
Lit...
db.people.createIndex({name: 1})
This creates an ascending single field index on the field name.
In this type of indexes the sort order is irrelevant, because mongo can traverse the index in both directions.
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...
1. Setup your formatter and routing in Register of (App_Start/WebApiConfig)
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
GlobalConfiguration.Configuration.Formatters.Clear();
GlobalConfiguration.Configuration.Formatters.Add...
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...
When should I use it
When the code inside an inline listener is too big and your method / class becomes ugly and hard to read
You want to perform same action in various elements (view) of your app
To achieve this you need to create a class implementing one of the listeners in the View API.
...
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() 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 ...
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...
gem 'omniauth-oauth2' , '~> 1.3.1'
gem 'omniauth'
gem 'omniauth-facebook'
gem 'omniauth-twitter'
gem 'omniauth-gplus'
gem 'omniauth-linkedin'
Run the bundle install command, restart your server and off you go!
Moving away from a buffer with unsaved changes will cause this error:
E37: No write since last change (add ! to override)
You can disable this by adding set hidden to your .vimrc file. With this option set your changes will persist in the buffer, but will not be saved to disk.
This is a copy of the advanced function snippet from the Powershell ISE. Basically this is a template for many of the things you can use with advanced functions in Powershell. Key points to note:
get-help integration - the beginning of the function contains a comment block that is set up to be ...