Tutorial by Examples

There are two approaches for influencing when a memory cleanup is performed. They are influencing how often the automatic process is performed and the other is manually triggering a cleanup. The garbage collector can be manipulated by tuning the collection thresholds which affect the frequency at w...
To manipulate colors we will modify the argb (Alpha, Red, Green and Blue) values of a color. First extract RGB values from your color. int yourColor = Color.parse("#ae1f67"); int red = Color.red(yourColor); int green = Color.green(yourColor); int blue = Color.blue(yourColor); Now...
If you want to clear your current Activity stack and launch a new Activity (for example, logging out of the app and launching a log in Activity), there appears to be two approaches. 1. Target (API >= 16) Calling finishAffinity() from an Activity 2. Target (11 <= API < 16) Intent intent ...
A few pre-requisites in the build.gradle for vectors to work all the way down to API 7 for VectorDrawables and API 13 for AnimatedVectorDrawables (with some caveats currently): //Build Tools has to be 24+ buildToolsVersion '24.0.0' defaultConfig { vectorDrawables.useSupportLibrary = true ...
Get the current date and time. public class Program { static void Main() { // create empty pipeline PowerShell ps = PowerShell.Create(); // add command ps.AddCommand("Get-Date"); // run command(s) Console.WriteLine(&quot...
In order to clear (flush) the entire log: adb logcat -c
HTML email is the use of a subset of HTML and CSS to format an email message like a web page using colors, graphics, table columns and links. When you send an email it’s important to send both plain text and HTML. You do this by sending your email as multi-part MIME. Most email service providers ha...
(Caveat emptor: there are many, many programmers who go into absolute conniptions if they meet code that uses recordsets instead of commands and stored procedures.) <% dim rs, sql dim SelectedUser SelectedUser = request.form("user") if IsNumeric(SelectedUser) then SelectedUser...
To add shadows to text, use the text-shadow property. The syntax is as follows: text-shadow: horizontal-offset vertical-offset blur color; Shadow without blur radius h1 { text-shadow: 2px 2px #0000FF; } This creates a blue shadow effect around a heading Shadow with blur radius To add a...
Using UISettings, the appearance of the Google Map can be modified. Here is an example of some common settings: mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); mGoogleMap.getUiSettings().setMapToolbarEnabled(true); mGoogleMap.getUiSettings().setZoomControlsEnabled(true); mGoog...
The syntax for using the aws cli is as follows: aws [options] <command> <subcommand> [parameters] Some examples using the 'ec2' command and the 'describe-instances' subcommand: aws ec2 describe-instances aws ec2 describe-instances --instance-ids <your-id> Example with a ...
aws s3 ls Use a named profile aws --profile myprofile s3 ls List all objects in a bucket, including objects in folders, with size in human-readable format and a summary of the buckets properties in the end - aws s3 ls --recursive --summarize --human-readable s3://<bucket_name>/
You can do a permissions check when sending an Intent to a registered broadcast receiver. The permissions you send are cross-checked with the ones registered under the tag. They restrict who can send broadcasts to the associated receiver. To send a broadcast request with permissions, specify the p...
A function declared inline may be defined in multiple translation units, provided that all definitions are identical. It also must be defined in every translation unit in which it is used. Therefore, inline functions should be defined in headers and there is no need to mention them in the implementa...
Once you understand how to create an HTTP Server with node, it's important to understand how to make it "do" things based on the path that a user has navigated to. This phenomenon is called, "routing". The most basic example of this would be to check if (request.url === 'some/pa...
C++11 Note: in all the following, the existence of the C++11 constant nullptr is assumed. For earlier versions, replace nullptr with NULL, the constant that used to play a similar role. Creating a pointer variable A pointer variable can be created using the specific * syntax, e.g. int *pointer_...
$ mkdir backup_download_directory && cd !#:1 mkdir backup_download_directory && cd backup_download_directory This will substitute the Nth argument of the current command. In the example !#:1 is replaced with the first argument, i.e. backup_download_directory.
$ mplayer Lecture_video_part1.mkv $ ^1^2^ mplayer Lecture_video_part2.mkv This command will replace 1 with 2 in the previously executed command. It will only replace the first occurrence of the string and is equivalent to !!:s/1/2/. If you want to replace all occurrences, you have to use !!:gs...
$ apt-get install r-base E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? $ sudo !! sudo apt-get install r-base [sudo] password for <user>:
This is a TCP daytime client kept as simple as possible. #include <unistd.h> /* unix standard library */ #include <arpa/inet.h> /* IP addresses manipulation utilities */ #include <netinet/in.h> /* sockaddr_in structure definition */ #include <sys/socket.h> /* ber...

Page 683 of 1336