Each Java Thread has an interrupt flag, which is initially false. Interrupting a thread, is essentially nothing more than setting that flag to true. The code running on that thread can check the flag on occasion and act upon it. The code can also ignore it completely.
But why would each Thread have...
The double tap, like a single tap, also uses the UITapGestureRecognizer. You simply set the numberOfTapsRequired to 2.
Swift
override func viewDidLoad() {
super.viewDidLoad()
// Double Tap
let doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTa...
The UILongPressGestureRecognizer lets you listen for a long press on a view. You can set the length of delay before the action method is called.
Swift
override func viewDidLoad() {
super.viewDidLoad()
// Long Press
let longPressGesture = UILongPressGestureRecognizer(target: self, ...
Swipe gestures allow you to listen for the user moving their finger across the screen quickly in a certain direction.
Swift
override func viewDidLoad() {
super.viewDidLoad()
// Swipe (right and left)
let swipeRightGesture = UISwipeGestureRecognizer(target: self, action: #selector(...
Pinches are a two fingered gesture where the fingers move closer or farther from each other. This gesture is generally used for resizing a view.
Swift
override func viewDidLoad() {
super.viewDidLoad()
// Pinch
let pinchGesture = UIPinchGestureRecognizer(target: self, action: #sele...
Two fingers rotating around a center can be listened for with the UIRotationGestureRecognizer. This is generally used for rotating a view.
Swift
override func viewDidLoad() {
super.viewDidLoad()
// Rotate
let rotateGesture = UIRotationGestureRecognizer(target: self, action: #selec...
Drag a gesture recognizer from the object library onto your view.
Control drag from the gesture in the Document Outline to your View Controller code in order to make an Outlet and an Action.
Notes
This example comes from this fuller sample project demonstrating gesture recognizers.
Objects come in their own class, so a simple example would be a car (detailed explanations below):
public class Car {
//Variables describing the characteristics of an individual car, varies per object
private int milesPerGallon;
private String name;
private String color;
...
Development and Evaluation Installations
Alfresco provides a number of different installers for different operating systems and platforms. However, these installers are not recommended for production environments.
https://www.alfresco.com/alfresco-community-download
https://sourceforge.net/projec...
# Process substitution with paste command is common
# To compare the contents of two directories
paste <( ls /path/to/directory1 ) <( ls /path/to/directory1 )
We can use PrintStream class to write a file. It has several methods that let you print any data type values. println() method appends a new line.
Once we are done printing, we have to flush the PrintStream.
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.time.Local...
Python programs can read from unix pipelines. Here is a simple example how to read from stdin:
import sys
for line in sys.stdin:
print(line)
Be aware that sys.stdin is a stream. It means that the for-loop will only terminate when the stream has ended.
You can now pipe the output of anot...
Consider the following three equations:
x0 + 2 * x1 + x2 = 4
x1 + x2 = 3
x0 + x2 = 5
We can express this system as a matrix equation A * x = b with:
A = np.array([[1, 2, 1],
[0, 1, 1],
[1, 0, 1]])
b = np.array([4, 3, 5])
Then, use np.linalg....
A try-finally block may be nested inside a try-except block.
try
AcquireResources;
try
UseResource;
finally
ReleaseResource;
end;
except
on E: EResourceUsageError do begin
HandleResourceErrors;
end;
end;
If an exception occurs inside UseResource, then execution...
A try-except block may be nested inside a try-finally block.
AcquireResource;
try
UseResource1;
try
UseResource2;
except
on E: EResourceUsageError do begin
HandleResourceErrors;
end;
end;
UseResource3;
finally
ReleaseResource;
end;
If an EResourceUsageE...
The tr method returns a copy of a string where the characters of the first argument are replaced by the characters of the second argument.
"string".tr('r', 'l') # => "stling"
To replace only the first occurrence of a pattern with with another expression use the sub method
...
When using clustered index, the rows of the table are sorted by the column to which the clustered index is applied. Therefore, there can be only one clustered index on the table because you can't order the table by two different columns.
Generally, it is best to use clustered index when performing ...
Nonclustered indexes are stored separately from the table. Each index in this structure contains a pointer to the row in the table which it represents.
This pointers are called a row locators. The structure of the row locator depends on whether the data pages are stored in a heap or a clustered tab...
Config a remote for my fork
$ cd my_local_repo
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# Specify a new remote upstream repository that will be synced with the fork
$ git remote -v
# Verify the new upstream repository specified for my f...