Tutorial by Examples: bi

With XML::Rabbit it is possible to consume XML files easily. You define in a declarative way and with an XPath syntax what you are looking for in the XML and XML::Rabbit will return objects according to the given definition. Definition: package Bookstore; use XML::Rabbit::Root; has_xpath_object_...
2.02 Preparation $ mkdir globbing $ cd globbing $ mkdir -p folder/{sub,another}folder/content/deepfolder/ touch macy stacy tracy "file with space" folder/{sub,another}folder/content/deepfolder/file .hiddenfile $ shopt -u nullglob $ shopt -u failglob $ shopt -u dotglob $ shopt -u n...
You can combine the results of two identically structured queries with the UNION keyword. For example, if you wanted a list of all contact info from two separate tables, authors and editors, for instance, you could use the UNION keyword like so: select name, email, phone_number from authors u...
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...
devise_for :users, controllers: {omniauth_callbacks: 'users/omniauth_callbacks'}
EntryPage.xaml: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:vm="clr-namespace:MyAssembly.ViewModel;a...
Create interface for clickHandler public interface ClickHandler { public void onButtonClick(View v); } Layout XML <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> ...
Converter between boolean and visibility. Get bool value on input and returns Visibility value. NOTE: This converter have already exists in System.Windows.Controls namespace. public sealed class BooleanToVisibilityConverter : IValueConverter { /// <summary> /// Convert bool or Nu...
SELECT name, caption as title, year, pages FROM books UNION SELECT name, title, year, 0 as pages FROM movies When combining 2 record sets with different columns then emulate the missing ones with default values.
Angular js directives can be nested or be made interoperable. In this example, directive Adir exposes to directive Bdir it's controller $scope, since Bdir requires Adir. angular.module('myApp',[]).directive('Adir', function () { return { restrict: 'AE', controlle...
A quick note before actually installing RabbitMQ: Ubuntu 14.04's Erlang packages have issues if you are using SSL with RabbitMQ, so you'll need to install a newer version than what the Ubuntu package maintainers provide, so use the binaries at https://www.erlang-solutions.com/resources/download.html...
It is sometimes argued that, for the sake of efficiency, we must accept the use of non-monotonic constructs in real-world Prolog programs. There is no evidence for this. Recent research indicates that the pure monotonic subset of Prolog may not only be sufficient to express most real-world programs...
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 ...
When to use abstract classes: To implement the same or different behaviour among multiple related objects When to use interfaces: to implement a contract by multiple unrelated objects Abstract classes create "is a" relations while interfaces provide "has a" capability. This c...
When expecting someone to reproduce an R code that has random elements in it, the set.seed() function becomes very handy. For example, these two lines will always produce different output (because that is the whole point of random number generators): > sample(1:10,5) [1] 6 9 2 7 10 >...
Configuring your environment RabbitMQ looks for an set of environment variables in /etc/rabbitmq/rabbitmq-env.conf. If it does not exist, it assumes default values. All values in rabbitmq-env.conf get exported to the environment the RabbitMQ server runs in with a RABBITMQ_ prefix; this prefix is no...
The permutation method, when called with a block yields a two dimensional array consisting of all ordered sequences of a collection of numbers. If this method is called without a block, it will return an enumerator. To convert to an array, call the to_a method. ExampleResult[1,2,3].permutation#&lt...
This example is inspired by this question. We'll assume you know how to load a file using the File API. // preliminary code to handle getting local file and finally printing to console // the results of our function ArrayBufferToBinary(). var file = // get handle to local file. var reader = new...
Structure for Binary Search Tree (BST) nodes: struct node { int data; node * left; node * right; } Search Algorithm // Check if a value exists in the tree bool BSTSearch(node * current, int value) { if (current->data == value) { return true; } e...
dput() and dget() The easiest way to share a (preferable small) data frame is to use a basic function dput(). It will export an R object in a plain text form. Note: Before making the example data below, make sure you're in an empty folder you can write to. Run getwd() and read ?setwd if you need t...

Page 12 of 29