Tutorial by Examples: apt

Sometimes specific instances of data should be used. Recreation is not desired and referencing static data would have a code smell. It is possible to specify a XmlAdapter instance the Unmarshaller should use, which allows the user to use XmlAdapters with no zero-arg constructor and/or pass data to ...
Functions which return a character vector Base R has two functions for invoking a system command. Both require an additional parameter to capture the output of the system command. system("top -a -b -n 1", intern = TRUE) system2("top", "-a -b -n 1", stdout = TRUE) ...
Open Android Monitor Tab Click on Screen Capture Button
Open Android Device Monitor ( ie C:<ANDROID_SDK_LOCATION>\tools\monitor.bat) Select your device Click on Screen Capture Button
Example below saves a screenshot on Devices's Internal Storage. adb shell screencap /sdcard/screen.png
If you use Linux (or Windows with Cygwin), you can run: adb shell screencap -p | sed 's/\r$//' > screenshot.png
A real world example using a scientific experiment where certain routines are performed on different types of tissue. The class contains two functions by default to get the tissue or routine separately. In a later version we have then adapted it using a new class to add a function that gets both. Th...
Lets assume that in your current codebase, there exists MyLogger interface like so: interface MyLogger { void logMessage(String message); void logException(Throwable exception); } Lets say that you've created a few concrete implementations of these, such as MyFileLogger and MyConsol...
impl<K, V> Serialize for MyMap<K, V> where K: Serialize, V: Serialize { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer { let mut state = serializer.serialize_map(Some(self.len()))?; ...
// A Visitor is a type that holds methods that a Deserializer can drive // depending on what is contained in the input data. // // In the case of a map we need generic type parameters K and V to be // able to set the output type correctly, but don't require any state. // This is an example of a...
To validate arguments to methods called on a mock, use the ArgumentCaptor class. This will allow you to extract the arguments into your test method and perform assertions on them. This example tests a method which updates the name of a user with a given ID. The method loads the user, updates the na...
Iterator methods can be broken into two distinct groups: Adapters Adapters take an iterator and return another iterator // Iterator Adapter // | | let my_map = (1..6).map(|x| x * x); println!("{:?}", my_map); Output Map { iter: 1..6 } Note that the v...
Values passed as enum constructor arguments can be captured into variables by use of pattern matching. Assume the following enum: enum Color { RGB(r : Int, g : Int, b : Int); HSV(h : Int, s : Float, v : Float); } The red channel value can be captured as follows: var color = Color.RG...
package com.example.xml.adapters; import javax.xml.bind.annotation.adapters.XmlAdapter; public class StringTrimAdapter extends XmlAdapter<String, String> { @Override public String unmarshal(String v) throws Exception { if (v == null) return null; ...
The class use Phalcon\Validation\Validator; use Phalcon\Validation\ValidatorInterface; use Phalcon\Validation\Message; class RecaptchaValidator extends Validator implements ValidatorInterface { public function validate(\Phalcon\Validation $validation, $attribute) { $value =...
// Get the reference to your ListView ListView listResults = (ListView) findViewById(R.id.listResults); // Set its adapter listResults.setAdapter(adapter); // Enable filtering in ListView listResults.setTextFilterEnabled(true); // Prepare your adapter for filtering adapter.setFilter...
This is a .NET regex specific modifier expressed with n. When used, unnamed groups (like (\d+)) are not captured. Only valid captures are explicitly named groups (e.g. (?<name> subexpression)). (?n)(\d+)-(\w+)-(?<id>\w+) will match the whole 123-1_abc-00098, but (\d+) and (\w+) won't...
public static async Task<IRandomAccessStream> ConvertWriteableBitmapToRandomAccessStream(WriteableBitmap writeableBitmap) { var stream = new InMemoryRandomAccessStream(); BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream); Stream pixe...
By default the ArrayAdapter class creates a view for each array item by calling toString() on each item and placing the contents in a TextView. To create a complex view for each item (for example, if you want an ImageView for each array item), extend the ArrayAdapter class and override the getView(...
If you know you need a packet <packet>, but you don't know the exact name <packet-exact-name>, instead of searching with Google try with the following: sudo apt-get update apt-cache search <packet> This will return you a list of packets name with a description. Once you have i...

Page 3 of 6