Tutorial by Examples: l

Google's Include What You Use project, or IWYU, ensures source files include all headers used in the code. Suppose a source file source.c includes a header arbitrary.h which in turn coincidentally includes freeloader.h, but the source file also explicitly and independently uses the facilities from ...
The C standard says that there is very little difference between the #include <header.h> and #include "header.h" notations. [#include <header.h>] searches a sequence of implementation-defined places for a header identified uniquely by the specified sequence between the &l...
If a singleshot timer is required, it is quiet handy to have the slot as lambda function right in the place where the timer is declared: QTimer::singleShot(1000, []() { /*Code here*/ } ); Due to this Bug (QTBUG-26406), this is way is only possible since Qt5.4. In earlier Qt5 versions it has to ...
Debian, Ubuntu and CentOS Add the official repository Debian/Ubuntu curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash CentOS curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.rpm.sh ...
Run the following as root: userdel -r username
groups More detailed information about user and group numerical IDs can be found with the id command.
groups username More detailed information about user and group numerical IDs can be found with id username.
This can be useful if you're writing a game or something that needs to execute a piece of code every a few seconds. import android.os.Handler; public class Timer { private Handler handler; private boolean paused; private int interval; private Runnable task = new Runnable ...
// World physics self.physicsWorld.gravity = CGVectorMake(0, -9.8);
Firstly, we set node category let groundBody: UInt32 = 0x1 << 0 let boxBody: UInt32 = 0x1 << 1 Then add Ground type node and Box type node. let ground = SKSpriteNode(color: UIColor.cyanColor(), size: CGSizeMake(self.frame.width, 50)) ground.position = CGPointMake(CGRectGetMidX(sel...
Set scene as delegate //set your scene as SKPhysicsContactDelegate class yourScene: SKScene, SKPhysicsContactDelegate self.physicsWorld.contactDelegate = self; Then you have to implement one or the other of the contact functions: optional func didBegin(contact:) and/or optional fund didEnd...
MSBuild evaluates PropertyGroup, Choose and ItemGroup elements that are directly under the Project element before those that are in Target elements. Directly under the Project element, PropertyGroup and Choose elements are evaluated in the order in which they appear, and then ItemGroup elements a...
add_action( 'init', function() { // do something here } ); Using a function block to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components.
function my_init_function() { // do something here } add_action( 'init', 'my_init_function' ); Using the name of the function to hook a set of instructions. With the init hook, the set of instructions will be executed right after wordpress has finished loading the necessary components. ...
class MyClass { static function my_init_method() { // do something here } } add_action( 'init', array( 'MyClass', 'my_init_method' ) ); Using a static method of a class to hook a set of instructions. With the init hook, the set of instructions will be executed right after w...
class MyClass { function my_init_method() { // do something here } } $obj = new MyClass(); add_action( 'init', array( $obj, 'my_init_method' ) ); Using a method of an object to hook a set of instructions. With the init hook, the set of instructions will be executed right...
if (a > b) { trace("You win!"); } else if (a == b) { trace("It's a draw!"); } else { trace("You lose!"); } // Assigning the evaluated expression to a variable var message = if (a > b) { "You win!"; } else if (a == b) { &...
A loop is a control flow structure to definitely or indefinitely run a set of statement written only once in code, until a certain condition is met or the process is terminated. Condition loops These loops are repeated based on the state of their conditions. For loops For loops are usually run...
If different users need different datetime format then you may need to parse your incoming date string to actual date according to the format. In this case this snippet may help you. public class DateTimeBinder : DefaultModelBinder { public override object BindModel(ControllerContext control...
In this example you'll learn how to share a file with other apps. We'll use a pdf file in this example although the code works with every other format as well. The roadmap: Specify the directories in which the files you want to share are placed To share files we'll use a FileProvider, a class all...

Page 542 of 861