Tutorial by Examples: c

Open routes file. Paste the following code in: Route::get('helloworld', function () { return '<h1>Hello World</h1>'; }); after going to route localhost/helloworld it displays Hello World. The routes file is located: 5.3 For Web routes/web.php For APIs routes/api.php ...
Remove the token from the client storage to avoid usage Tokens are issued by the server and you can not force browsers to delete a cookie/localStorage or control how external clients are managing your tokens. Obviously if attackers have stolen the token before logout they still could use the token,...
Mark invalid tokens, store until their expiration time and check it in every request. Blacklist breaks JWT statelessness because it requires maintaining the state. One of the benefits of JWT is no need server storage, so if you need to revoke tokens without waiting for the expiration, think also ab...
Allow change user unique ID if account is compromised with a new user&password login To invalidate tokens when user changes their password or permissions, sign the token with a hash of those fields. If any of these field change, any previous tokens automatically fail to verify. The down...
This is a simple example to search in Google. It containt two parts, Feature File Step Definition File Am not going into much details here as the code itself is self explanatory. Feature File Feature:Google Key word search @mytag Scenario: search Spec Flow in Google search bar Given...
If you want to use "cmake" (see www.cmake.org), type cd [your libpng source directory] cmake . -DCMAKE_INSTALL_PREFIX=/path make make install where "/path" points to the installation directory where you want to put the libpng "lib", "include", and &quot...
This will download libpng from the official "git" repository and build it in your "libpng" directory. git clone https://github.com/glennrp/libpng.git libpng cd libpng ./autogen.sh ./configure [--prefix=/path] make install where "/path" points to the installation...
Basic architecture examples on how development for embedded systems works (i.e. IDEs, cross-compiling, downloading, in-line debugging, JTAG,...) and what would be the minimum requirements for starting. It would be worth mentioning different approaches and platforms from begginers-higher level to ad...
import { expect } from 'chai'; import { createStore } from 'redux'; describe('redux store test demonstration', () => { describe('testReducer', () => { it('should increment value on TEST_ACTION', () => { // define a test reducer with initial state: test: 0 const te...
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...
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...

Page 530 of 826