Tutorial by Examples: action

Transactions can be used to make multiple changes to the database atomically. Any normal transaction follows this pattern: // You need a writable database to perform transactions final SQLiteDatabase database = openHelper.getWritableDatabase(); // This call starts a transaction database.beginT...
A less known builtin feature is Controller Action injection using the FromServicesAttribute. [HttpGet] public async Task<IActionResult> GetAllAsync([FromServices]IProductService products) { return Ok(await products.GetAllAsync()); } An important note is that the [FromServices] c...
By default the Large Object Heap is not compacted unlike the classic Object Heap which can lead to memory fragmentation and further, can lead to OutOfMemoryExceptions Starting with .NET 4.5.1 there is an option to explicitly compact the Large Object Heap (along with a garbage collection): GCSettin...
(foreach) This class can be thought of logically as a buffer for data to be processed combined with tasks for processing that data, with the “dataflow block” managing both. In its most basic usage, we can instantiate an ActionBlock and “post” data to it; the delegate provided at the ActionBlock’s c...
A lexer action is a block of arbitrary code in the target language surrounded by {...}, which is executed during matching: IDENTIFIER: [A-Z]+ { log("matched rule"); }; A semantic predicate is a block of arbitrary code in the target language surrounded by {...}?, which evaluates to a bo...
When inheriting from base Controller class provided by the framework, you can use the convenience method ViewComponent() to return a view component from the action: public IActionResult GetMyComponent() { return ViewComponent("Login", new { param1 = "foo", param2 = 42 }); ...
You can run a play which relies on vault-encrypted templates by using the local_action module. --- - name: Decrypt template local_action: "shell {{ view_encrypted_file_cmd }} {{ role_path }}/templates/template.enc > {{ role_path }}/templates/template" changed_when: False - ...
Simple example of using the Chrome Logging API. Template.landingPage.events({ 'click .selectItemButton':function(){ // color code and count the user interaction (blue) console.count('click .selectItemButton'); } });
// thecontroller.js $scope.sendVerifyEmail = function() { console.log('Email sent, whaaaaam!'); currentAuth.sendEmailVerification(); } // where currentAuth came from something like this: // routerconfig .... templateUrl: 'bla.html', resolve: { currentAuth:['Auth', functio...
The following code has undefined behavior: char buffer[6] = "hello"; char *ptr1 = buffer - 1; /* undefined behavior */ char *ptr2 = buffer + 5; /* OK, pointing to the '\0' inside the array */ char *ptr3 = buffer + 6; /* OK, pointing to just beyond */ char *ptr4 = buffer + 7; /* un...
Blueprint actions (not to be confused with blueprint action routes) are generic actions designed to work with any of your controllers that have a model of the same name (e.g. ParrotController would need a Parrot model). Think of them as the default behavior for your application. For instance, if...
To show and hide a FloatingActionButton with the default animation, just call the methods show() and hide(). It's good practice to keep a FloatingActionButton in the Activity layout instead of putting it in a Fragment, this allows the default animations to work when showing and hiding. Here is an ...
DatabaseTransactions trait allows databases to rollback all the change during the tests. If you want to rollback multiple databases , you need to set $connectionsToTransact properties use Illuminate\Foundation\Testing\DatabaseMigrations; class ExampleTest extends TestCase { use Databas...
Passing Variable in URL as a method's parameter return $this->redirect([ 'controller' => 'users', 'action' => 'profile', $id ]); Url should be looks like this http://your_app_url/users/profile/{id} in UsersController.php file in profile() method class UsersController e...
public void MoveToStateAndExecuteActions(Item item, ID workflowStateId) { Sitecore.Workflows.IWorkflowProvider workflowProvider = Item.Database.WorkflowProvider; Sitecore.Workflows.IWorkflow workflow = workflowProvider.GetWorkflow(item); // if item is in any workflow if (workf...
It is possible to perform ViewActions on a view using the perform method. The ViewActions class provides helper methods for the most common actions, like: ViewActions.click() ViewActions.typeText() ViewActions.clearText() For example, to click on the view: onView(...).perform(click()); onVi...
The basic math operations are performed mainly on numbers or on vectors (lists of numbers). 1. Using single numbers We can simple enter the numbers concatenated with + for adding and - for subtracting: > 3 + 4.5 # [1] 7.5 > 3 + 4.5 + 2 # [1] 9.5 > 3 + 4.5 + 2 - 3.8 # [1] 5.7 >...
This will rollback both inserts due to an invalid datetime: BEGIN TRANSACTION BEGIN TRY INSERT INTO dbo.Sale(Price, SaleDate, Quantity) VALUES (5.2, GETDATE(), 1) INSERT INTO dbo.Sale(Price, SaleDate, Quantity) VALUES (5.2, 'not a date', 1) COMMIT TRANSACTION END TRY BEG...
manifest.json { "name": "Hello Page", "description": "Add 'Hello' to the current page.", "version": "1.0", "permissions": [ "activeTab" ], "background": { "scripts": [&quo...
These functions take a Variant that can be cast to a Date as a parameter and return an Integer representing a portion of a date or time. If the parameter can not be cast to a Date, it will result in a run-time error 13: Type mismatch. FunctionDescriptionReturned valueYear()Returns the year portion ...

Page 3 of 8