Tutorial by Examples: di

To discovery all the available print services, we can use the PrintServiceLookup class. Let's see how: import javax.print.PrintService; import javax.print.PrintServiceLookup; public class DiscoveringAvailablePrintServices { public static void main(String[] args) { discoverPrintS...
To discovery the default print service, we can use the PrintServiceLookup class. Let's see how:: import javax.print.PrintService; import javax.print.PrintServiceLookup; public class DiscoveringDefaultPrintService { public static void main(String[] args) { discoverDefaultPrintSer...
Doc is an interface and the Java Print Service API provide a simple implementation called SimpleDoc. Every Doc instance is basically made of two aspects: the print data content itself (an E-mail, an image, a document etc) the print data format, called DocFlavor (MIME type + Representation class...
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. Implementation in Java public class EditDistance { public static void main(String[] args) { // TODO Auto-generated ...
We’ll first go over gaze-based interactions. Gaze-based interactions rely on rotating our heads and looking at objects to interact with them. This type of interaction is for headsets without a controller. Even with a rotation-only controller (Daydream, GearVR), the interaction is still similar. Sinc...
To add visual feedback to the cursor to show when the cursor is clicking or fusing, we can use the animation system. When the cursor intersects the entity, it will emit an event, and the animation system will pick up event with the begin attribute: <a-entity cursor="fuse: true; fuseTimeout:...
Install properties reader: npm install properties-reader --save Create a directory env to store your properties files: mkdir env Create environments.js: process.argv.forEach(function (val, index, array) { var arg = val.split("="); if (arg.length > 0) { ...
In this example, we take a sine curve plot and add more features to it; namely the title, axis labels, title, axis ticks, grid and legend. # Plotting tutorials in Python # Enhancing a plot import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2.0*np.pi, 101) y = np.sin(x) ...
Many custom views need to accept user interaction in the form of touch events. You can get access to touch events by overriding onTouchEvent. There are a number of actions you can filter out. The main ones are ACTION_DOWN: This is triggered once when your finger first touches the view. ACTION_MO...
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...
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 ...
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...
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 = ...
In PHP, variable values have an associated "truthiness" so even non-boolean values will equate to true or false. This allows any variable to be used in a conditional block, e.g. if ($var == true) { /* explicit version */ } if ($var) { /* $var == true is implicit */ } Here are some fun...
Array ( [0] => Array ( [id] => 13 [category_id] => 7 [name] => Leaving Of Liverpool [description] => Leaving Of Liverpool [price] => 1.00 [virtual] => 1 [active] =...
In memory, an image can be seen as a matrix of pixel (color). However, when an image being stored in a permanent storage, it may be stored as is (RAW format), Bitmap or other image formats with particular compression algorithm for saving storage space, e.g. PNG, JPEG, GIF, etc. When loading an image...
The arguments passed from the console can be received in the Kotlin program and it can be used as an input. You can pass N (1 2 3 and so on) numbers of arguments from the command prompt. A simple example of a command-line argument in Kotlin. fun main(args: Array<String>) { println(&qu...

Page 158 of 164