Tutorial by Examples

The common case for injecting dependencies into a class is with constructor injection. This involves annotating a constructor on the class with @Inject. The CDI manager will look for a constructor with the @Inject annotation when creating an instance of the class. When it finds an @Inject-annotated ...
Server Side example Create Listener for server Start of with creating an server that will handle clients that connect, and requests that will be send. So create an Listener Class that will handle this. class Listener { public Socket ListenerSocket; //This is the socket that will listen ...
A MultiTrigger is similar to a standard Trigger in that it only applies to properties within the same control. The difference is that a MultiTrigger has multiple conditions which must be satisfied before the trigger will operate. Conditions are defined using the <Condition> tag. <TextBlock...
The same example from above can also be done using what is known as field injection. Instead of annotating the constructor with @Inject, we annotate the fields we wish to have injected public class Spaceship { @Inject private PropulsionSystem propulsionSystem; @Inject private ...
WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen (e.g. during an AJAX request or wp-cron run). //enable defi...
WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not. The default is 'true' which shows errors and warnings as they are generated. Setting this to false will hide all errors. This should be used in conjunction with WP_DEBUG_...
Example of how to calculate the output shape and overcome the difficulties of using tf.nn.conv2d_transpose with unknown batch size (when input.get_shape() is (?, H, W, C) or (?, C, H, W)). def upconvolution (input, output_channel_size, filter_size_h, filter_size_w, stride_h, str...
public class DependentScopedClass { //This class has no scoping annotations, so a new instance gets created at every injection point. @Inject public DependentScopedClass(SomeDependency someDependency) { doSomethingWith(someDependency); } } The default scope for...
@RequestScoped public class RequestScopedClass { //This class gets constructed once per Servlet request, and is shared among all CDI-managed classes within that request. @Inject public RequestScopedClass(SomeDependency someDependency) { doSomethingWith(someDependency); ...
@ApplicationScoped public class ApplicationScopedClass { //This class gets constructed once for the entire life of the application, and is shared among all CDI-managed classes throughout the life of the application. @Inject public ApplicationScopedClass(SomeDependency someDependenc...
@SessionScoped public class SessionScopedClass implements Serializable { //This class gets constructed once per session, and is shared among all CDI-managed classes within that session. Notice that it implements Serializable, since the instance will get put on the session. @Inject ...
SCRIPT_DEBUG is a related constant that will force WordPress to use the "dev" versions of core CSS and JavaScript files rather than the minified versions that are normally loaded. This is useful when you are testing modifications to any built-in .js or .css files. Default is false. //enab...
The SAVEQUERIES definition saves the database queries to an array and that array can be displayed to help analyze those queries. The constant defined as true causes each query to be saved, how long that query took to execute, and what function called it. NOTE: This will have a performance impact on...
The following code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It will also hide the errors so they do not interrupt page generation. // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug...
Add the rx-android dependency as well as a current version of rx-java to the build.gradle. Because RxAndroid releases are few and far between, it is recommended you also explicitly depend on RxJava's latest version for bug fixes and new features. Rx1 compile 'io.reactivex:rxandroid:1.2.1' co...
:wqall Exiting multiple files with saving contents :qall! Exiting multiple files without saving contents
Once you have installed Visual Studio from https://www.visualstudio.com/downloads/, start a new project. Select 'Windows Forms Application' from Visual Basic Tab. You can rename it here if you need to. Once you click 'OK', you will see this window: Click on the 'Toolbo...
Bridge Mode $ docker run –d –-name my_app -p 10000:80 image_name Note that we did not have to specify --net=bridge because this is the default working mode for docker. This allows to run multiple containers to run on same host without any assignment of dynamic port. So BRIDGE mode avoids the por...
Another common type of loop in Visual Basic is the DO loop, which would run a piece of code continuously until it is told to stop. On the contrary of some other loops whereby indexes are used to stop the process, in this particular loop, it should be told to stop. A simple example illustrating the ...
Dialog dlg; DialogGroup dGrp; DialogField dfName; dlg = new Dialog("Trivial Dialog"); dGrp = dlg.addGroup("A Group"); dfName = dlg.addField(extendedTypeStr(Name)); if (dlg.run()) { info(dfName.value()); } Extended data types have to be wrapped in a call to ext...

Page 1210 of 1336