Tutorial by Examples: o

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...
n % 2 == 0 ? trace("n is even!") : trace("n is odd!"); // Assigning the evaluated expression to a variable var message = n % 2 == 0 ? "n is even!" : "n is odd!"; trace(message); Reference "If", Haxe manual
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...
public void doSomething() { DialogTestBinding binding = DataBindingUtil .inflate(LayoutInflater.from(context), R.layout.dialog_test, null, false); Dialog dialog = new Dialog(context); dialog.setContentView(binding.getRoot()); dialog.show(); }
Pulls the code from a certain specified file into another file where the call was made. E.g. inside example.php <h1>Hello World!</h1> Inside page.php // header code get_template_part('example'); // rest of page code Output: // header code <h1>Hello World</h1> /...
Any middleware registered as routeMiddleware in app/Http/Kernel.php can be assigned to a route. There are a few different ways to assign middleware, but they all do the same. Route::get('/admin', 'AdminController@index')->middleware('auth', 'admin'); Route::get('admin/profile', ['using' => ...
When the command-line syntax for an application is simple, it is reasonable to do the command argument processing entirely in custom code. In this example, we will present a series of simple case studies. In each case, the code will produce error messages if the arguments are unacceptable, and the...
This example shows how to use the Firebase Cloud Messaging(FCM) platform. FCM is a successor of Google Cloud Messaging(GCM). It does not require C2D_MESSAGE permissions from the app users. Steps to integrate FCM are as follows. Create sample hello world project in Android Studio Your Android...
Professionally made web applications don't expose the internal details of the server environment to the user. When you place an order at your retailer, you don't see (or have to type) https://mydealer.com:8443/Dealerapp/entryPage.html, but just mydealer.com, although the app server needs all the det...
Angular 1 is at heart a DOM compiler. We can pass it HTML, either as a template or just as a regular web page, and then have it compile an app. We can tell Angular to treat a region of the page as an expression using the {{ }} handlebars style syntax. Anything between the curly braces will be compi...
To start Alfresco: Switch to the alfresco user Change to the $ALFRESCO_HOME directory Run ./alfresco.sh start To stop Alfresco: Switch to the alfresco user Change to the $ALFRESCO_HOME directory Run ./alfresco.sh start
Alfresco logs live in $ALFRESCO_HOME/tomcat/logs/catalina.out.
A behavior based animation allows you to specify that when a property changes the change should be animated over time. ProgressBar { id: progressBar from: 0 to: 100 Behavior on value { NumberAnimation { duration: 250 } } } In this example ...
Let's assume an associative array aa: int[string] aa = ["x": 5, "y": 6]; Items can be removed by using .remove(), if key exits will be removed and remove returns true: assert(aa.remove("x")); if the given key does not exist remove does nothing and returns false:...
The StretchViewport is a Viewporttype, which supports a virtual screen size. This allowes you to define a fixed (resolution independent) width and height. The StretchViewport, as the name suggests, stretches the virtual screen, if the virtual aspect ratio does not match the real aspect ratio. The ...
Scala's implementation of type classes is rather verbose. One way to reduce the verbosity is to introduce so-called "Operation Classes". These classes will automatically wrap a variable/value when they are imported to extend functionality. To illustrate this, let us first create a simple ...

Page 661 of 1038