Tutorial by Examples: ti

A new memory block on the heap is allocated using the new expression, which returns a pointer to the managed memory: void main() { int* a = new int; *a = 42; // dereferencing import std.stdio : writeln; writeln("a: ", *a); }
You will need the guice-bridge in your project. @ApplicationPath("api") public class ApiRest extends ResourceConfig { @Inject public ApiRest(ServiceLocator serviceLocator, ServletContext servletContext) { packages("net.sargue.app.api"); GuiceBrid...
Please note that this example uses OpenCV 3.1. import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.imgproc.Imgproc; import org.opencv.o...
This example introduces the VideoCapture class, where we use it to take an image from a webcam and save it to an image. import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.imgc...
This example by Daniel Baggio was taken directly from this StackExchange answer, but has been reposted for visibility. This class takes an Mat object and returns the BufferedImage object used by the javax.swing libraries. This can be used by a Graphics object to draw the image. private BufferedIma...
This example uses Dice and the black spots on the dice (the pips) as our object. As the example is quite long, first explaining some key concepts is critical to understanding the example. Understanding the first example, "Getting a static image, detecting items on it, and outputting the result...
To submit form via Ajax with Jquery : <div id="yourPanel" th:fragment="yourFragment"> <form id="yourForm" method="POST" th:action="@{/actions/postForm}" th:object="${yourFormBean}">...
You can use the raw interpolator if you want a String to be printed as is and without any escaping of literals. println(raw"Hello World In English And French\nEnglish:\tHello World\nFrench:\t\tBonjour Le Monde") With the use of the raw interpolator, you should see the following printed in the ...
Zero values or zero initialization are simple to implement. Coming from languages like Java it may seem complicated that some values can be nil while others are not. In summary from Zero Value: The Go Programming Language Specification: Pointers, functions, interfaces, slices, channels, and maps ...
You will have to import UserNotifications @import UserNotifications; 2.Request authorization for localNotification let center = UNUserNotificationCenter.current() center.requestAuthorization([.alert, .sound]) { (granted, error) in // Enable or disable features based on authorizat...
For this the best solution is using actions. To add a new action to an actors in Scene2D just call: Action action = Actions.moveTo(x,y,duration); actorObject.addAction(action); Where x and y is the target location and duration is the speed of this movement in seconds(float). If you want to sto...
For automation of the above procedure in Windows use a .bat of the similar contents: del "main.exe" python setup.py build_ext --inplace del "*.c" rmdir /s /q ".\build" pyinstaller --onefile "main.py" copy /y ".\dist\main.exe" ".\main.exe&q...
Represents the definition of a single approval process. Use this object to read the description of an approval process. The definition is read-only. We can not modify the record created in ProcessDefinition Object. But we can describe, query, search and retrieve the approval processes information. ...
Add the following to Web.config (in Views folder), within <appSettings>: <add key="ClientValidationEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/> Add the jqueryval bundle to BundleConfig.cs: bundles.Add(n...
This attribute handles all unhandled exceptions in the code, (this is mostly for Ajax Requests - that deal with JSON - but can be extended) public class ExceptionHandlerAttribute : HandleErrorAttribute { /// <summary> /// Overriden method to handle exception /// </summary...
To create a template for the single posts of our custom post type, we need to create a file called single-post_type_name.php where post_type_name is the name of our custom post type. For example, if our custom post type is called “Books”, we need to create a PHP file called single-book.php. Note th...
This is what I do when I'm working with Firebase and I want to use ListView. Use a parent component to retrieve the data from Firebase (Posts.js): Posts.js import PostsList from './PostsList'; class Posts extends Component{ constructor(props) { super(props); this.state =...
The Constructor Dependency Injection requires parameters in the constructor to inject dependencies. So you have to pass the values when you create a new object. public class Example { private readonly ILogging _logging; public Example(ILogging logging) { this._logging = l...
function processGoogleDriveFolders() { var arrayAllFolderNames,continuationToken,folders,foldersFromToken,thisFolder;//Declare variable names arrayAllFolderNames = [];//Create an empty array and assign it to this variable name folders = DriveApp.getFolders();//Get all folders from G...
function processGoogleDriveFiles() { var arrayAllFileNames,continuationToken,files,filesFromToken,fileIterator,thisFile;//Declare variable names arrayAllFileNames = [];//Create an empty array and assign it to this variable name files = DriveApp.getFiles();//Get all files from Google...

Page 328 of 505