Tutorial by Examples: er

The easiest way to handle and manage gems is by using bundler. Bundler is a package manager comparable to bower. To use bundler you first need to install it. gem install bundler After you have bundler up and running all you need to do is add gems to your Gemfile and run bundle in your termi...
Here is an example of basic overriding in Python (for the sake of clarity and compatibility with both Python 2 and 3, using new style class and print with ()): class Parent(object): def introduce(self): print("Hello!") def print_name(self): print("Parent...
There are hundreds of settings that can be placed in my.cnf. For the 'lite' user of MySQL, they won't matter as much. Once your database becomes non-trivial, it is advisable to set the following parameters: innodb_buffer_pool_size This should be set to about 70% of available RAM (if you have a...
ALTER TABLE foo ENGINE=InnoDB; This converts the table, but does not take care of any differences between the engines. Most differences will not matter, especially for small tables. But for busier tables, other considerations should be considered. Conversion considerations
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <circle r="30" cx="100" cy="100" fill="rgb(255, 0, 0)" stroke="rgb(0, 255, 0)" /> <rect x="200" y="200" w...
You can also update data in a table based on data from another table: UPDATE person SET state_code = cities.state_code FROM cities WHERE cities.city = city; Here we are joining the person city column to the cities city column in order to get the city's state code. This is then used to updat...
Microsoft.CSharp.CSharpCodeProvider can be used to compile C# classes. var code = @" public class Abc { public string Get() { return ""abc""; } } "; var options = new CompilerParameters(); options.GenerateExecutable = false; options.GenerateInMe...
The option -v followed by an assignment of the form variable=value can be used to pass parameters to an awk program. This is illustrated by the punishment program below, whose job is to write count times the sentence “I shall not talk in class.” on standard output. The following example uses the v...
Download and install Visual Studio Community 2015 Open Visual Studio Community Click File -> New -> Project Click Templates -> Visual C++ -> Win32 Console Application and then name the project MyFirstProgram. Click Ok Click Next in the following window. Check the Empty proj...
Each Error object has a string property named stack that contains the stack trace:
Place assertions in your JavaScript code by calling console.assert() with the error condition as the first parameter. When this expression evaluates to false, you will see a corresponding console record:
In many instances, you will want to send data from the R server to the JS client. Here is a very simple example: library(shiny) runApp( list( ui = fluidPage( tags$script( "Shiny.addCustomMessageHandler('message', function(params) { alert(params); });" ), ...
Downloading a file from the internet is a very common task required by almost every application your likely to build. To accomplish this, you can use the "System.Net.WebClient" class. The simplest use of this, using the "using" pattern, is shown below: using (var webClient = n...
angular.module('app', []) .controller('myController', ['$scope', function($scope){ $scope.person = { name: 'John Doe' }; }]); <div ng-app="app" ng-conroller="myController"> <input ng-model="person.name" /> <div ng-repeat="number i...
In javascript, assigning a non-primitive value (Such as Object, Array, Function, and many more), keeps a reference (an address in the memory) to the assigned value. Assigning a primitive value (String, Number, Boolean, or Symbol) to two different variables, and changing one, won't change both: var...
Filtering a list down to only the elements we want to do. Lodash provides a function called _.filter filters elements based on the predicate function you provide. A predicate is a function that takes data in and returns either true or false. Let's look at how we'd get just the even numbers from...
A minimal Dockerfile looks like this: FROM alpine CMD ["echo", "Hello StackOverflow!"] This will instruct Docker to build an image based on Alpine (FROM), a minimal distribution for containers, and to run a specific command (CMD) when executing the resulting image. Build an...
Group common operations Docker builds images as a collection of layers. Each layer can only add data, even if this data says that a file has been deleted. Every instruction creates a new layer. For example: RUN apt-get -qq update RUN apt-get -qq install some-package Has a couple of downsides: ...
It is possible to save a Docker container's filesystem contents to a tarball archive file. This is useful in a pinch for moving container filesystems to different hosts, for example if a database container has important changes and it isn't otherwise possible to replicate those changes elsewhere. Pl...
let numbers = [3, 1, 4, 1, 5] // non-functional for (index, element) in numbers.enumerate() { print(index, element) } // functional numbers.enumerate().map { (index, element) in print((index, element)) }

Page 129 of 417