Tutorial by Examples: bac

There are two ways to register a background page in the extension manifest. The scripts property In the common case, a background page doesn't require any HTML markup. We can register these kinds of background pages using the scripts property. In this case, a background page will be generated...
+ (CALayer *)gradientBGLayerForBounds:(CGRect)bounds colors:(NSArray *)colors { CAGradientLayer * gradientBG = [CAGradientLayer layer]; gradientBG.frame = bounds; gradientBG.colors = colors; return gradientBG; }
PubNub Access Manager (PAM) extends PubNub's existing security framework by allowing developers to create and enforce secure access to channels throughout the PubNub Real Time Network. Access Manager allows you to manage granular permissions for your realtime apps and data streams, create multiple ...
If you need to send events from fragment to activity, one of the possible solutions is to define callback interface and require that the host activity implement it. Example Send callback to an activity, when fragment's button clicked First of all, define callback interface: public interface Samp...
You can display an SVG file within an HTML document, by specifying it as a background image in CSS. For example: .element { background-size: 100px 100px; background: url(my_svg_file.svg); height: 100px; width: 100px; } If the dimensions specified in your SVG file are larger ...
this topic is a classical issue in iOS development, and its solution is various as other example already shown. In this example I'll show another daily common use one: passing data using closure by adapting delegate pattern example on this page into callback closure! one thing this method is superi...
Problem: You need to match text of a certain format, for example: 1-a-0 6/p/0 4 g 0 That's a digit, a separator (one of -, /, or a space), a letter, the same separator, and a zero. Naïve solution: Adapting the regex from the Basics example, you come up with this regex: [0-9]([-/ ])[a-z]\...
Consider using Extension Methods as Functions which wrap other code, here's a great example that uses both a static method and and extension method to wrap the Try Catch construct. Make your code Bullet Proof... using System; using System.Diagnostics; namespace Samples { /// <summary&g...
If you wish to make a complete backup of a large MySql installation and do not have sufficient local storage, you can dump and compress it directly to an Amazon S3 bucket. It's also a good practice to do this without having the DB password as part of the command: mysqldump -u root -p --host=localho...
BackAndroid.addEventListener('hardwareBackPress', function() { if (!this.onMainScreen()) { this.goBack(); return true; } return false; }); Note: this.onMainScreen() and this.goBack() are not built in functions, you also need to implement those. (https://github.c...
There are two types of callbacks associated with committing and rolling back transactions: after_commit and after_rollback. after_commit callbacks are called on every record saved or destroyed within a transaction immediately after the transaction is committed. after_rollback callbacks are called o...
ActiveRecord::Base.transaction uses the ActiveRecord::Rollback exception to distinguish a deliberate rollback from other exceptional situations. Normally, raising an exception will cause the .transaction method to rollback the database transaction and pass on the exception. But if you raise an Activ...
#demo-element { background: @theme-color; color: contrast(@theme-color, black, white, 50%); } @theme-color: red; The above example will set the text color of the element as white if the background-color is dark and vice-versa. This is achieved using the contrast() color operation functi...
.my-div { width: 300px; height: 200px; background-size: 100%; background-repeat: no-repeat; background-image: linear-gradient(to right, black 0%,white 100%), url('https://static.pexels.com/photos/54624/strawberry-fruit-red-sweet-54624-medium.jpeg'); background-blend-mod...
One of the use cases of callback URLs is OAuth. Let us do this with an Instagram Login: If the user enters their credentials and clicks the Login button, Instagram will validate the credentials and return an access_token. We need that access_token in our app. For our app to be able to listen to suc...
Inside your layout, add a Login button with the following code: <com.twitter.sdk.android.core.identity.TwitterLoginButton android:id="@+id/twitter_login_button" android:layout_width="wrap_content" android:layout_height="wrap_content" and...
in styles.xml add your custom style: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppBaseTheme" parent="@android:style/Theme.Light.NoTitleBar.Fullscreen"> </style> </resources> Create your custom...
Redis configuration: Install redis (2.4+ required) Install phpredis Install the Magento extension Cm_Cache_Backend_Redis (only for Magento 1.7 and below) Edit your app/etc/local.xml: <global> ... <cache> <backend>Cm_Cache_Backend_Redis</backend> <b...
SoundEffect.Play() plays the sound effect in a "fire-and-forget" fashion. The sound plays once and its lifetime is managed by the framework. You are not able to change the properties (volume, pan, pitch) of the sound during playback, loop it, position it in 3D or pause it. You can hold a ...
#include <Servo.h> Servo srv; void setup() { srv.attach(9); // Attach to the servo on pin 9 } To use a servo, you need to call attach() function first. It starts generating a PWM signal controlling a servo on a specified pin. On boards other than Arduino Mega, use of Servo lib...

Page 5 of 12