Tutorial by Examples: bac

preg_replace_callback works by sending every matched capturing group to the defined callback and replaces it with the return value of the callback. This allows us to replace strings based on any kind of logic. $subject = "He said 123abc, I said 456efg, then she said 789hij"; $regex = &q...
By default stored procedures and functions or not generated by mysqldump, you will need to add the parameter --routines (or -R): mysqldump -u username -p -R db_name > dump.sql When using --routines the creation and change time stamps are not maintained, instead you should dump and reload the ...
In order to convert any callback API to promises assuming the promisify and promisifyAll version doesn't fit - you can use the promise constructor. Creating promises generally means specifying when they settle - that means when they move to the fulfilled (completed) or rejected (errored) phase to i...
AUTOCOMMIT MySQL automatically commits statements that are not part of a transaction. The results of any UPDATE,DELETE or INSERT statement not preceded with a BEGIN or START TRANSACTION will immediately be visible to all connections. The AUTOCOMMIT variable is set true by default. This can be chan...
import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.sw...
The following command backs up the 'Users' database to 'D:\DB_Backup' file. Its better to not give an extension. BACKUP DATABASE Users TO DISK = 'D:\DB_Backup'
Mongoose connect has 3 parameters, uri, options, and the callback function. To use them see sample below. var mongoose = require('mongoose'); var uri = 'mongodb://localhost:27017/DBNAME'; var options = { user: 'user1', pass: 'pass' } mongoose.connect(uri, options, function(err){...
To restore a file to the latest updated svn version, i.e. undo the local changes, you can use revert: svn revert file To restore a file to an older version (revision XXX) use update: svn update -r XXX file Warning: in both cases you will lose any local changes in the file because it will be ...
Express passes a next callback to every route handler and middleware function that can be used to break logic for single routes across multiple handlers. Calling next() with no arguments tells express to continue to the next matching middleware or route handler. Calling next(err) with an error will ...
The background script is like any other JavaScript code. You can debug it using same tools you debug other JavaScript code in Chrome. To open the Chrome Developer Tools, go to chrome://extensions, and turn on Developer mode: Now you can debug any extension that have a background page or script. ...
Animating Background color of stacklayout on tapping button pages/main.component.ts import {Component, ElementRef, ViewChild} from "@angular/core"; import {Color} from "color"; import {View} from "ui/core/view"; @Component({ selector: "main&quot...
The background task are a great way to perform some work while your application is not running. Before being able to use then , you will have to register them. Here is a sample of a background task class including the registration with a trigger and a condition and the Run implementation public se...
Configuring a private registry to use an AWS S3 backend is easy. The registry can do this automatically with the right configuration. Here is an example of what should be in your config.yml file: storage: s3: accesskey: AKAAAAAACCCCCCCBBBDA secretkey: rn9rjnNuX44iK+26qpM4cDEo...
In PubNub JavaScript v3, you could implement a unique callback for every channel that you subscribed to as long as you called the subscribe function for each channel and implemented the callback in that subscribe like this: var pubnub = new PubNub({ publishKey: "your-pub-key", s...
Executing a task with the background worker. Double Click on the BackgroundWorker control from the Toolbox This is how the BackgroundWorker appears after adding it. Double click on the added control to get the BackgroundWorker1_DoWork event and add the code to be executed when the BackgroundW...
You cannot access any GUI components from the BackgroudWorker. For example if you try to do something like this Private Sub BackgroundWorker1_DoWork(sender As Object, e As DoWorkEventArgs) TextBox1.Text = "Done" End Sub you will receive a runtime error saying that "Cross-thr...
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...

Page 7 of 12