Tutorial by Examples: is

class ImageCreationExample { static Image createSampleImage() { // instantiate a new BufferedImage (subclass of Image) instance BufferedImage img = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB); //draw something on the image paintOnI...
public static void saveImage(String destination) throws IOException { // method implemented in "Creating a simple image Programmatically and displaying it" example BufferedImage img = createSampleImage(); // ImageIO provides several write methods with different outputs ...
/** * Checks if a resource exists by sending a HEAD-Request. * @param url The url of a resource which has to be checked. * @return true if the response code is 200 OK. */ public static final boolean checkIfResourceExists(URL url) throws IOException { HttpURLConnection conn = (HttpURLCo...
$ gzip extremelylargefile.txt & $ bg $ disown %1 This allows a long running process to continue once your shell (terminal, ssh, etc) is closed.
It is (almost always) a bad idea to call System.gc(). The javadoc for the gc() method specifies the following: "Calling the gc method suggests that the Java Virtual Machine expend effort toward recycling unused objects in order to make the memory they currently occupy available for quick re...
Open Computing Language (OpenCL) is a framework for writing programs that execute on CPUs, GPUs, and other parallel processors and accelerators. OpenCL specifies a programming language (based on C) that provides access to named on-chip memory, a model for executing tasks in parallel, and the abilit...
In C and C++, the asterisk in the declaration of a pointer variable is part of the expression being declared. In C#, the asterisk in the declaration is part of the type. In C, C++ and C#, the following snippet declares an int pointer: int* a; In C and C++, the following snippet declares an int ...
Implementation of IDatabaseInitializer that is used in EntityFramework by default. As the name implies, it creates the database if none exists. However when you change the model, it throws an exception. Usage: public class MyContext : DbContext { public MyContext() { Database.SetIni...
context.globalCompositeOperation = "destination-over" "destination-over" compositing places new drawing under existing drawings. context.drawImage(rainy,0,0); context.globalCompositeOperation='destination-over'; // sunny UNDER rainy context.drawImage(sunny,0,0);
context.globalCompositeOperation = "destination-out" "destination-out" compositing uses new shapes to erase existing drawings. The new shape is not actually drawn -- it is just used as a "cookie-cutter" to erase existing pixels. context.drawImage(apple,0,0); conte...
context.globalCompositeOperation = "source-over" "source-over" compositing [default], places all new drawings over any existing drawings. context.globalCompositeOperation='source-over'; // the default context.drawImage(background,0,0); context.drawImage(parachuter,0,0); ...
This example shows how to advertise a custom payload from a Windows 10 device in the foreground. The payload uses a made up company (identified as 0xFFFE) and advertises the string Hello World in the advertisement. BluetoothLEAdvertisementPublisher publisher = new BluetoothLEAdvertisementPublisher(...
General Listening This example shows how to listen for a specific advertisement. BluetoothLEAdvertisementWatcher watcher = new BluetoothLEAdvertisementWatcher(); // Use active listening if you want to receive Scan Response packets as well // this will have a greater power cost. watcher.Scanni...
It took me a while to get this right, so I decided to share a solution because it might save someone else several days of trial and error. The problem: I want to be able to enable/disable WCF tracing in my C# .NET application and choose the trace output filename. I don't want users editing the .con...
let playerLayoutChangeListener = new android.view.View.OnLayoutChangeListener( { onLayoutChange : function ( v:View, left:number, top:number, right:number, bottom:number, oldLeft:number, oldTop:number, oldRight:number, oldBottom:number):any { if (left != oldLeft || top != oldTop ...
A computed column is computed from an expression that can use other columns in the same table. The expression can be a noncomputed column name, constant, function, and any combination of these connected by one or more operators. Create table with a computed column Create table NetProfit ( Sa...
Multiple comparison operators used together are chained, as if connected via the && operator. This can be useful for readable and mathematically concise comparison chains, such as # same as 0 < i && i <= length(A) isinbounds(A, i) = 0 < i ≤ length(A) # same as Set...
If you implement or create a listener in an Activity, always pay attention to the lifecycle of the object that has the listener registered. Consider an application where we have several different activities/fragments interested in when a user is logged in or out. One way of doing this would be to h...
In order to prevent a button from firing multiple times within a short period of time (let's say 2 clicks within 1 second, which may cause serious problems if the flow is not controlled), one can implement a custom SingleClickListener. This ClickListener sets a specific time interval as threshold (...
In list context hash is flattened. my @bar = ( %hash, %hash ); The array @bar is initialized by list of two %hash hashes both %hash are flattened new list is created from flattened items @bar array is initialized by that list It is guaranteed that key-value pairs goes together. Keys are...

Page 62 of 109