Tutorial by Examples: actions

Database transactions ensure that a set of data changes will only be made permanent if every statement is successful. Any query or code failure during a transaction can be caught and you then have the option to roll back the attempted changes. PDO provides simple methods for beginning, committing,...
With UIAlertController, action sheets like the deprecated UIActionSheet are created with the same API as you use for AlertViews. Simple Action Sheet with two buttons Swift let alertController = UIAlertController(title: "Demo", message: "A demo with two buttons", preferredStyle...
resources :photos do member do get 'preview' end collection do get 'dashboard' end end This creates the following routes in addition to default 7 RESTful routes: get '/photos/:id/preview', to: 'photos#preview' get '/photos/dashboards', to: '...
You can use engine.begin to open a connection and begin a transaction that will be rolled back if an exception is raised, or committed otherwise. This is an implicit way of using a transaction, since you don't have the option of rolling back manually. with engine.begin() as conn: conn.execute(...
The UIAlertController available since iOS8 allows you to use the same alert object for either Action sheets or more classic alerts. The only difference is the UIAlertControllerStyle passed as a parameter when creating. This line changes from an AlertView to an ActionSheet, compared to some other ex...
string urlWebsite = "http://MyServer/sites/MySiteCollection"; ClientContext clientContext = new ClientContext(urlWebsite); Web oWebsite = clientContext.Web; UserCustomActionCollection collUserCustomAction = oWebsite.UserCustomActions; UserCustomAction oUserCustomAction = collUserCu...
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...
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'); } });
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...
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...
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...
Whenever you change data, in a Data Manipulation Language(DML) command, you can wrap your changes in a transaction. DML includes UPDATE, TRUNCATE, INSERT and DELETE. One of the ways that you can make sure that you're changing the right data would be to use a transaction. DML changes will take a loc...
#Persistent Menu, Tray, NoStandard ; remove default tray menu entries Menu, Tray, Add, MyDefaultAction, OnDefaultTrayAction ; add a new tray menu entry Menu, Tray, Add, Exit, Exit ; add another tray menu entry Menu, Tray, Default, MyDefaultAction ;When doubleclicking the tray icon, run the tra...
Problem By default, Django immediately commits changes to the database. When exceptions occur during a series of commits, this can leave your database in an unwanted state: def create_category(name, products): category = Category.objects.create(name=name) product_api.add_products_to_cate...
BEGIN TRY -- start error handling BEGIN TRANSACTION; -- from here on transactions (modifictions) are not final -- start your statement(s) select 42/0 as ANSWER -- simple SQL Query with an error -- end your statement(s) COMMIT TRANSACTION; -- finalize all transa...
Sometimes it is necessary to do an action on repeat or in a sequence. This example will make the node fade in and out a total of 3 times. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionFadeOut = SKAction.fadeOutWithDuration(1.0) let actionFadeIn = SKAction.fadeInWithD...
Adding a product to a shopping cart (Label item.name references the name property of the product added): ga('send', 'event', 'Cart', 'Add', product.name); This lets you see what people are adding to the shopping cart, even if they never complete the order, allowing more insight into where users ...
PHP Classes are powerful tool for improving code organization and minimizing naming collisions. At some point or another, the question of how to create an action hook for a class method inevitably arises. The $function_to_add argument is often shown as a string containing the function's name, howev...
If you want your card to include buttons, use the md-card-actions directive. Buttons can also be formatted differently for icon-only buttons. Search for icons at here if you're using Google's Material Icons. <md-card> <!--header--> <md-card-content> <p> ...
Actions are located in /usr/local/etc/scanbd/scanbd.conf. I have 4 buttons that are scan, copy, email and file. The default config file doesn't include all actions per default, you will probably have to add the block manually. You can have less or more buttons depending of your scanner model. ...

Page 1 of 2