Tutorial by Examples: e

A minimal example of using SWIG. HelloWorld.i, the SWIG interface file %module helloworld //the name of the module SWIG will create %{ //code inside %{...%} gets inserted into the wrapper file #include "myheader.h" //helloworld_wrap.cxx includes this header %} ...
Returns a new deque object initialized left-to-right (using append()) with data from iterable. If iterable is not specified, the new deque is empty. Deques are a generalization of stacks and queues (the name is pronounced “deck” and is short for “double-ended queue”). Deques support thread-safe, me...
installing pytest: pip install pytest getting the tests ready: mkdir tests touch tests/test_docker.py Functions to test in docker_something/helpers.py: from subprocess import Popen, PIPE # this Popen is monkeypatched with the fixture `all_popens` def copy_file_to_docker(src, dest): ...
because a struct is also a data type, it can be used as an anonymous field, the outer struct can directly access the fields of the embedded struct even if the struct came from a diffrent package. this behaviour provides a way to derive some or all of your implementation from another type or a set of...
In Go a method is a function that acts on a variable of a certain type, called the receiver the receiver can be anything, not only structs but even a function, alias types for built in types such as int, string, bool can have a method, an exception to this rule is that interfaces(discussed lat...
the receiver of a method is usually a pointer for performance reason because we wouldn't make a copy of the instance, as it would be the case in value receiver, this is especially true if the receiver type is a struct. anoter reason to make the receiver type a pointer would be so we could modify the...
Interfaces provide a way to specify the behaviour of an object, if something can do this then it can be used here. an interface defines a set of methods, but these methods do not contain code as they are abstract or the implemntation is left to the user of the interface. unlike most Object Oriented ...
In the following example we will create a service with the name visualizer. We will specify a custom label and remap the internal port of the service from 8080 to 9090. In addition we will bind mount an external directory of the host into the service. docker service create \ --name=visual...
This simple exampe will create a hello world web service that will listen on the port 80. docker service create \ --publish 80:80 \ tutum/hello-world
You can install mocha either globally or in your project folder. The latter is the preferred way. In all the example let's assume that all the test files are in a test folder within the project folder. Install Mocha locally To install mocha in your project folder, you can use the following npm co...
import spock.lang.* class HelloWorldSpec extends Specification { @Shared message = 'Hello world!' def "The world can say hello using when and then"() { when: def newMessage = message then: newMessage == 'Hello world!' } ...
Contrary to Drupal 7 you cannot call regular PHP functions in your templates. In Drupal 8 the way to go is by creating filters and functions. You should use a filter when: you want to transform the data you want to display. Imagine you have a title that you want to always be uppercase. For example,...
This example will show you how to use Dependency Inject to use other services registered in the Drupal environment. Imagine you have an SVG image file that changes colors depending on some random CSS/Javascript thing in your project. To be able to target the SVG with CSS you have to actually have t...
A Seaside component (subclass of WAComponent) needs to override #renderContentOn:. It is a smalltalk class that can use all the normal ways of structuring an application. Here it delegates to three different methods. JQDroppableFunctionalTest>>renderContentOn: html self renderInstructions...
Sometimes Lua doesn't behave the way one would think after reading the documentation. Some of these cases are: Nil and Nothing aren't the same (COMMON PITFALL!) As expected, table.insert(my_table, 20) adds the value 20 to the table, and table.insert(my_table, 5, 20) adds the value 20 at the 5th po...
There are several ways to mark a comment block as a detailed description, so that this comment block is parsed by Doxygen and added as a description of the following code item to the documentation. The first and most common one are C style comments with an extra asterisk in the comment start sequenc...
Detailed instructions on getting split set up or installed.
import SpriteKit import UIKit class GameRoomTableView: UITableView,UITableViewDelegate,UITableViewDataSource { var items: [String] = ["Player1", "Player2", "Player3"] override init(frame: CGRect, style: UITableViewStyle) { super.init(frame: frame, s...
dev.office.com/sharepoint is a great place to get started with the SharePoint Framework. The SharePoint Framework is a modern, client side approach to SharePoint Development initially targeted at SharePoint Online in Office 365. Web parts created with the SharePoint Framework are a new type of web ...
Using the Flyable example as a starting point, we can add a second interface, Swimmable, with the following code: Sub Swim() ' No code End Sub The Duck object can Implement both flying and swimming: Implements Flyable Implements Swimmable Public Sub Flyable_Fly() Debug.Print &quo...

Page 983 of 1191