Tutorial by Examples: ed

Seismic is an Android device shake detection library by Square. To use it just start listening to the shake events emitted by it. @Override protected void onCreate(Bundle savedInstanceState) { sm = (SensorManager) getSystemService(SENSOR_SERVICE); sd = new ShakeDetector(() -> { /* rea...
ImageMagick includes a number of command-line utilities for manipulating images. Here we will use compare command-line tool. compare tool is very useful. Suppose you want to test (e.g. layout, color, icons etc.) the difference between your expected design UI HTML file with actual result of JSP...
The problem statement is like if we are given two string str1 and str2 then how many minimum number of operations can be performed on the str1 that it gets converted to str2.The Operations can be: Insert Remove Replace For Example Input: str1 = "geek", str2 = "gesek" Ou...
In order to trigger a "upgradeneeded" event you need to request the database with version higher than the current version - otherwise the event won't be triggered. function createTable(dbName, dbversion, tableName) { var request = indexedDB.open(dbName, dbversion); request.onupgrade...
This is a more generic solution applicable in system where the user has option to add indexes to the table that he uses: function createTable(dbName, tableName) { var request = indexedDB.open(dbName); request.onsuccess = function (e){ var database = e.target.result; var version = p...
As it can be seen from the picture above, on a single application we can create: Multiple databases Each database can have multiple object stores (tables) Each object store can have stored multiple objects
Suppose we have this source file that we would like to split: cat -n sourcefile 1 On the Ning Nang Nong 2 Where the Cows go Bong! 3 and the monkeys all say BOO! 4 There's a Nong Nang Ning 5 Where the trees go Ping! 6 And the tea pots jibber jabber joo. 7 On the Nong Ning Nang Comma...
To install PLY on your machine for python2/3, follow the steps outlined below: Download the source code from here. Unzip the downloaded zip file Navigate into the unzipped ply-3.10 folder Run the following command in your terminal: python setup.py install If you completed all the above, you...
This section explains how the tokenized input from Part 1 is processed - it is done using Context Free Grammars (CFGs). The grammar must be specified, and the tokens are processed according to the grammar. Under the hood, the parser uses an LALR parser. # Yacc example import ply.yacc as yacc ...
Snippet from MainPage.xaml <Page x:Class="MyNewApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MyNewApp" xmlns:d="http...
Almost usually things are a little bit more complex and to support scalability we should split things apart. So we can define various files containing different resources dictionaries, i.e. resources for UI controls' themes, resources for texts and so on, then we merge them all together in App.xaml ...
Most Singleton examples use MonoBehaviour as the base class. The main disadvantage is that this Singleton class only lives during run time. This has some drawbacks: There is no way of directly editing the singleton fields other than changing the code. No way to store a reference to other assets...
We have seen in those examples (ex_1, ex_2) how to use and override the pagination classes in any generic class base view. What happens when we want to use pagination in a function based view? Lets also assume that we want to create a function based view for MyModel with PageNumberPagination, res...
You can use TO_CHAR( date_value, 'D' ) to get the day-of-week. However, this is dependent on the NLS_TERRITORY session parameter: ALTER SESSION SET NLS_TERRITORY = 'AMERICA'; -- First day of week is Sunday SELECT TO_CHAR( DATE '1970-01-01', 'D' ) FROM DUAL; Outputs 5 ALTER SESSION SET ...
BottomSheet DialogFragment opens up in STATE_COLLAPSED by default. Which can be forced to open to STATE_EXPANDEDand take up the full device screen with help of the following code template. @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { BottomSheetDialog dialog = ...
This is what I did to install CakePHP on a fresh installed minimal CentOS 7 Installed a CentOS-7-x86_64-Minimal-1611.iso in VirtualBox, two network interfaces: first NAT, second Host-Only set ONBOOT=yes in /etc/sysconfig/network-scripts/ifcfg-enp0s3 reboot yum update yum install net-tools (to...
As it can be seen on the picture above, in indexed db in order to access the data you need to have: Open a connection to the desired database Open a transaction which can be read only or read write Open a cursor or index which can be used for filtering the data In the cursor request - onsucc...
1.1.2 (This content is only relavant for versions 1.1.2 and up) From versions 1.1.2 and up, you can set the delay to select a new chip before refocusing on the input. Use the md-chip-append-delay attribute to set it (in milliseconds): Example: <md-chips md-chip-append-delay="500" n...
The easiest way to connect via curl to a different server is to alter the hosts file on your machine. On Linux and Unix systems, the hosts file is located in /etc/hosts, while on Windows systems it will be located in c:\windows\system32\drivers\etc\hosts. Once you open the file with a text editor ...
from django.contrib.auth.models import User class UserAdmin(admin.ModelAdmin): list_display = ('email', 'first_name', 'last_name') list_filter = ('is_staff', 'is_superuser') admin.site.unregister(User) admin.site.register(User, UserAdmin) We need to unregister before regis...

Page 139 of 145