// A simple class hierarchy that uses the visitor to add functionality.
//
class VehicleVisitor;
class Vehicle
{
public:
// To implement the visitor pattern
// The class simply needs to implement the accept method
// That takes a reference to a visitor object tha...
The visitor Pattern can be used to traverse structures.
class GraphVisitor;
class Graph
{
public:
class Node
{
using Link = std::set<Node>::iterator;
std::set<Link> linkTo;
public:
void accept(GraphVisito...
Since Java lambdas are closures, they can "capture" the values of variables in the enclosing lexical scope. While not all lambdas capture anything -- simple lambdas like s -> s.length() capture nothing and are called stateless -- capturing lambdas require a temporary object to hold the...
Modules can be required without using relative paths by putting them in a special directory called node_modules.
For example, to require a module called foo from a file index.js, you can use the following directory structure:
index.js
\- node_modules
\- foo
|- foo.js
\- package.json
...
<?php
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class TestController extends Controller
{
//Inject Request HTTP Component in your function then able to exploit it
public function myFunctionAction(Request $request)
{...
If you like to show the dialog without the close button (i.e. the x button in the upper-right corner of the dialog), perhaps because you want to force the user to select one of options or buttons in the dialog itself:
1- Give your dialog a CSS class:
$("#selector").dialog({
closeOnE...
ngHref is used instead of href attribute, if we have a angular expressions inside href value. The ngHref directive overrides the original href attribute of an html tag using href attribute such as tag, tag etc.
The ngHref directive makes sure the link is not broken even if the user clicks the lin...
Download:
To set up WebSphere Liberty, download the latest zip from WASdev.net.
Layout:
Once you have the zip, extract it to any location on your file system. The basic layout of a Liberty install is the following:
wlp/ # WLP_INSTALL_DIR
bin/ # location of scrip...
Usage:
$ nodetool repair [-h | -p | -pw | -u] <flags> [ -- keyspace_name [table_name]]
Default Repair Option
$ nodetool repair
This command will repair the current node's primary token range (i.e. range which it owns) along with the replicas of other token ranges it has in all tables a...
Nesting is great for keeping related selectors together to make it easier for future developers to understand your code. The parent selector, represented by an ampersand ("&") can help do that in more complex situations. There are several ways its can be used.
Create a new selector th...
Add following Paths to the PATH-Enviromentvariable
[Path to CMake]\bin
[Path to Git]\bin
[Path to SDK]\tools
[Path to SDK]\platform-tools
[Path to NDK]
[Path to ANT]\bin
[Path to MinGW]\bin
[Path to MinGW]\msys\1.0\bin
[Path to Java jre]\bin
[Path to Java jdk]\bin
Make sure you use ba...
Clone the SFML Repository from Github.
Enter following comands in a cmd window:
git clone https://github.com/SFML/SFML.git SFML
If you already downloaded SFML before you can just use the existing one.
Create some folders for the build-files
cd SFML
mkdir build && cd build
mkdir ar...
You can find the Android Sample in [SFML_ROOT]\examples\android
You can copy it to leave the SFML repository in it's original state. Open cmd.exe in the sample location.
To get a list of all available Android build targets:
android list target
Run Update Project for the Sample:
android upda...
Mouse movement:
import java.awt.Robot;
public class MouseClass {
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
// SET THE MOUSE X Y POSITION
robot.mouseMove(300, 550);
}
}
Press left/right button of mouse:
import java.awt....
You can disable compiler warnings using #pragma warning disable and restore them using #pragma warning restore:
#pragma warning disable CS0168
// Will not generate the "unused variable" compiler warning since it was disabled
var x = 5;
#pragma warning restore CS0168
// Will gene...
Individual elements can be accessed through indexes. Python arrays are zero-indexed. Here is an example :
my_array = array('i', [1,2,3,4,5])
print(my_array[1])
# 2
print(my_array[2])
# 3
print(my_array[0])
# 1
my_array = array('i', [1,2,3,4,5])
my_array.append(6)
# array('i', [1, 2, 3, 4, 5, 6])
Note that the value 6 was appended to the existing array values.