Tutorial by Examples: di

If you can say “YAGNI” (You ain’t gonna need it) about a feature, you better not implement it. There can be a lot of development time saved through focussing onto simplicity. Implementing such features anyway can lead to problems: Problems Overengineering If a product is more complicated than it...
Accessing the array of calendars To access the array of EKCalendars, we use the calendarsForEntityType method: Swift let calendarsArray = eventStore.calendarsForEntityType(EKEntityType.Event) as! [EKCalendar] Iterating through calendars Just use a simple for loop: Swift for calendar in cale...
Creating the event object Swift var event = EKEvent(eventStore: eventStore) Objective-C EKEvent *event = [EKEvent initWithEventStore:eventStore]; Setting related calendar, title and dates Swift event.calendar = calendar event.title = "Event Title" event.startDate = startDate /...
This is an example to show how to change the allowed choices on a subCategory select field depending on the value of the category select field. To do that you have to make your subCategory choices dynamical for both client and server side. 1. Make the form dynamic on the client side for display / ...
Before reading and writing text files you should know what encoding to use. See the Perl Unicode Documentation for more details on encoding. Here we show the setting of UTF-8 as the default encoding and decoding for the function open. This is done by using the open pragma near the top of your code (...
HTML Import caching will sometimes mean that changes made to HTML files that get imported do not get reflected upon browser refresh. Take the following import as an example: <link rel="import" href="./my-element.html"> If a change is done to my-element.html after previo...
You may want to re-seed your database without affecting your previously created seeds. For this purpose, you can use firstOrCreate in your seeder: EmployeeType::firstOrCreate([ 'type' => 'manager', ]); Then you can seed the database: php artisan db:seed Later, if you want to add a...
To integrate Siri capabilities in your app, you should add an extensions as you would do while creating an iOS 10 Widget (old Today View Extension) or a custom keyboard. Adding capability 1- In the project settings, select your iOS app target and go to Capabilities tab 2- Enable the Siri capabili...
just execute uname -a. On Arch: $ uname -a Linux nokia 4.6.4-1-ARCH #1 SMP PREEMPT Mon Jul 11 19:12:32 CEST 2016 x86_64 GNU/Linuxenter code here
The sample content used here is Tears of Steel, by Blender Foundation. Specifically, we will use the download titled "HD 720p (~365MB, mov, 2.0)". This is a single file that ends with the extension "mov" and will play in just about any modern media player. Note that the download...
This example will explore how to see the layout of a video track and how to extract the individual pictures within it. The sample content used here is Tears of Steel, by Blender Foundation. Specifically, we will use the download titled "HD 720p (~365MB, mov, 2.0)". This is a single file t...
DASH is the most widely deployed adaptive streaming technology in modern solutions, used to deliver video in a wide variety of scenarios. The best way to understand DASH presentations is to observe the network activity that takes place during playback. This example uses Fiddler to capture and analy...
JSON is a very strict format (see http://json.org). That makes it easy to parse and write for machines but surprises humans when an inconspicuous mistakes breaks the document. Common Problems Trailing Comma Unlike most programming languages your are not allowed to add a trailing comma: { a: 1...
If you have predefined ranges and want to use specific colors for those ranges you can declare custom colormap. For example: import matplotlib.pyplot as plt import numpy as np import matplotlib.colors x = np.linspace(-2,2,500) y = np.linspace(-2,2,500) XX, YY = np.meshgrid(x, y) Z = np.sin(...
There are four primary useful functions for regular expressions, all of which take arguments in needle, haystack order. The terminology "needle" and "haystack" come from the English idiom "finding a needle in a haystack". In the context of regexes, the regex is the need...
The getForObject and getForEntity methods of RestTemplate load the entire response in memory. This is not suitable for downloading large files since it can cause out of memory exceptions. This example shows how to stream the response of a GET request. RestTemplate restTemplate // = ...; // Optio...
Radio Buttons allow you to let the user choose one element of those given. There are two ways to declare a RadioButton with a text besides it. Either by using the default constructor RadioButton() and setting the text with the setText(String) method or by using the other constructor RadioButton(Stri...
A ToggleGroup is used to manage the RadioButtons so that just one in each group can be selected at each time. Create a simple ToggleGroup like following: ToggleGroup group = new ToggleGroup(); After creating a Togglegroup it can be assigned to the RadioButtons by using setToggleGroup(ToggleGrou...
Typically, when one of the RadioButtons in a ToggleGroup is selected the application performs an action. Below is an example which prints the user data of the selected RadioButton which has been set with setUserData(Object). radioButton1.setUserData("awesome") radioButton2.setUserData(&q...
Let's say the second RadioButton out of three is pre-selected with setSelected(Boolean), the focus is still at the first RadioButton by default. To change this use the requestFocus() method. radioButton2.setSelected(true); radioButton2.requestFocus();

Page 103 of 164