Tutorial by Examples: er

Use the following piece of code to set the badge number from within your application (suppose someNumber has been declared before): Objective-C [UIApplication sharedApplication].applicationIconBadgeNumber = someNumber; Swift UIApplication.shared.applicationIconBadgeNumber = someNumber In order ...
Consider the following example: public final class Person { private final String firstName; private final String lastName; public Person(String firstName, String lastName) { this.firstName = (firstName == null) ? "" : firstName; this.lastName = (lastN...
This example uses C++14 and boost::any. In C++17 you can swap in std::any instead. The syntax we end up with is: const auto print = make_any_method<void(std::ostream&)>([](auto&& p, std::ostream& t){ t << p << "\n"; }); super_any<decltype(print...
project('projectA') { task A(dependsOn: ':projectB:B') << { println 'Hello from A' } } project('projectB') { task B << { println 'Hello from B' } } To refer to a task in another project, you prefix the name of the task with the path of the pr...
The remote module allows simple RMI (remote method invocation) of main process objects from renderer process. First create the main process in index.js const {app, BrowserWindow} = require('electron') let win = null app.on('ready', () => { win = new BrowserWindow() win.loadURL(`file://...
context.globalCompositeOperation = "destination-over" "destination-over" compositing places new drawing under existing drawings. context.drawImage(rainy,0,0); context.globalCompositeOperation='destination-over'; // sunny UNDER rainy context.drawImage(sunny,0,0);
context.globalCompositeOperation = "destination-out" "destination-out" compositing uses new shapes to erase existing drawings. The new shape is not actually drawn -- it is just used as a "cookie-cutter" to erase existing pixels. context.drawImage(apple,0,0); conte...
context.globalCompositeOperation = "source-over" "source-over" compositing [default], places all new drawings over any existing drawings. context.globalCompositeOperation='source-over'; // the default context.drawImage(background,0,0); context.drawImage(parachuter,0,0); ...
There are many reasons a write operation may fail. A frequent one is because your security rules reject the operation, for example because you're not authenticated (by default a database can only be accessed by an authenticated user). You can see these security rule violations in the logcat output....
task A << { println 'Hello from A' } task B << { println 'Hello from B' } B.mustRunAfter A The B.mustRunAfter A line tells Gradle to run task after task specified as an argument. And the output is: > gradle -q B A Hello from A Hello from B The ordering rule d...
Make sure the following dependency is added to your app's build.gradle file under dependencies: compile 'com.android.support:support-core-ui:25.3.0' Then add the ViewPager to your activity layout: <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layo...
We're using a toplevel guard in our route config to catch the current user on first page load, and a resolver to store the value of the currentUser, which is our authenticated user from the backend. A simplified version of our implementation looks as follows: Here is our top level route: export c...
This example shows how to advertise a custom payload from a Windows 10 device in the foreground. The payload uses a made up company (identified as 0xFFFE) and advertises the string Hello World in the advertisement. BluetoothLEAdvertisementPublisher publisher = new BluetoothLEAdvertisementPublisher(...
General Listening This example shows how to listen for a specific advertisement. BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher(); // Use active listening if you want to receive Scan Response packets as well // this will have a greater power cost. watcher.Scanni...
class Category(models.Model): name = models.CharField(max_length=20) class Product(models.Model): name = models.CharField(max_length=64) category = models.ForeignKey(Category, on_delete=models.PROTECT) To get the number products for each category: >>> categories = Ca...
Methods OnTriggerEnter() OnTriggerStay() OnTriggerExit() You can make a Collider into a Trigger in order to use the OnTriggerEnter(), OnTriggerStay() and OnTriggerExit() methods. A Trigger Collider will not physically react to collisions, other GameObjects simply pass through it. They are us...
Sometimes you might have branches lying around that have already had their changes merged into master. This finds all branches that are not master that have no unique commits as compared to master. This is very useful for finding branches that were not deleted after the PR was merged into master. ...
You can handle exceptions and throw a most friendly message like 'Unavailable service' throwing a FaultException: try { // your service logic here } catch (Exception ex) { // You can do something here, like log the original exception throw new FaultException("There was a pro...
void main() { var cat = new Cat(); print("Is cat hungry? ${cat.isHungry}"); // Is cat hungry? true print("Is cat cuddly? ${cat.isCuddly}"); // Is cat cuddly? false print("Feed cat."); cat.isHungry = false; print("Is cat ...
It took me a while to get this right, so I decided to share a solution because it might save someone else several days of trial and error. The problem: I want to be able to enable/disable WCF tracing in my C# .NET application and choose the trace output filename. I don't want users editing the .con...

Page 244 of 417