Tutorial by Examples

HtmlHelper.Action() @Html.Action(actionName: "Index") output: The HTML rendered by an action method called Index() @Html.Action(actionName: "Index", routeValues: new {id = 1}) output: The HTML rendered by an action method called Index(int id) @(Html.Action("In...
Project structure project/ group_vars/ development inventory.development playbook.yaml These variables will be applied to hosts under the development group due to the filename. --- ## Application app_name: app app_url: app.io web_url: cdn.io app_friendly: New App env_type: ...
Setup The tests below uses these values for the examples. val helloWorld = "Hello World" val helloWorldCount = 1 val helloWorldList = List("Hello World", "Bonjour Le Monde") def sayHello = throw new IllegalStateException("Hello World Exception") Type c...
Monkey patching is the modification of classes or objects outside of the class itself. Sometimes it is useful to add custom functionality. Example: Override String Class to provide parsing to boolean class String def to_b self =~ (/^(true|TRUE|True|1)$/i) ? true : false end end A...
Like patching of classes, you can also patch single objects. The difference is that only that one instance can use the new method. Example: Override a string object to provide parsing to boolean s = 'true' t = 'false' def s.to_b self =~ /true/ ? true : false end >> s.to_b =&...
A very simple example would be to fade out an SKSpriteNode. In Swift: let node = SKSpriteNode(imageNamed: "image") let action = SKAction.fadeOutWithDuration(1.0) node.runAction(action)
Sometimes it is necessary to do an action on repeat or in a sequence. This example will make the node fade in and out a total of 3 times. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionFadeOut = SKAction.fadeOutWithDuration(1.0) let actionFadeIn = SKAction.fadeInWithD...
One helpful case is to have the action run a block of code. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionBlock = SKAction.runBlock({ //Do what you want here if let gameScene = node.scene as? GameScene { gameScene.score += 5 } }) node.runActi...
If you want to use docker for rails app, and use database, you need to know that all the data in the docker container will be destroyed (unless you configure the container specifically for keeping data) Sometimes, you need to create a docker container with an application and attach it to an old con...
Controller: In the Controller you have to add the RequestHandler component. This Enables CakePHP to automatically detect Ajax requests(see: http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html for more info): class YourController extends AppController { public $compo...
To select an element by an exact HTML attribute use the css locator pattern [attribute=value] //selects the first element with href value '/contact' element(by.css('[href="/contact"]')); //selects the first element with tag option and value 'foo' element(by.css('option[value="f...
To select an element by an HTML attribute that contains a specified value use the css locator pattern [attribute*=value] //selects the first element with href value that contains'cont' element(by.css('[href*="cont"]')); //selects the first element with tag h1 and class attribute that...
Sometimes users from other regions than English-speaking have problems with encoding while for example programming a php project. It can be, that the server has another encoding then UTF-8, and if someone want to create a php project in UTF-8 on this server, his text might be shown incorrect. Examp...
One of most common use cases of Gitflow Initialize repo and define branches $ git flow init # if you use default setup, you'll define six types of branches: # # main branches (lives forever) # # 1. master: for production releases # 2. develop: for "next ...
Let us assume we have the following Series: >>> import pandas as pd >>> s = pd.Series([1, 4, 6, 3, 8, 7, 4, 5]) >>> s 0 1 1 4 2 6 3 3 4 8 5 7 6 4 7 5 dtype: int64 Followings are a few simple things which come handy when you are workin...
Pandas provides an effective way to apply a function to every element of a Series and get a new Series. Let us assume we have the following Series: >>> import pandas as pd >>> s = pd.Series([3, 7, 5, 8, 9, 1, 0, 4]) >>> s 0 3 1 7 2 5 3 8 4 9 5 1 ...
You can use Firebase Authentication to let your users authenticate with Firebase using their email addresses and passwords, and to manage your app's password-based accounts. In this example, we use these steps to set it up for our Android project which is based on JavaScript. But before doing so, ...
An Analyzer can be applied to a mapping by using "analyzer", by default the "standard" Analyzer is used. Alternatively, if you do not wish to have any analyzer used (because tokenizing or normalization would not be useful) you may specify "index":"not_analyzed&quo...
Sometimes it maybe useful to have multiple distinct indexes of a field with different Analyzers. You can use the multi-fields capability to do so. PUT my_index { "mappings": { "user": { "properties": { "name": { "type...
$rootScope.$on listeners will remain in memory if you navigate to another controller. This will create a memory leak if the controller falls out of scope. Don't angular.module('app').controller('badExampleController', badExample); badExample.$inject = ['$scope', '$rootScope']; function badExam...

Page 856 of 1336