Tutorial by Examples: bi

This uses the Dropbox Python SDK to create a shared link for a file and also supplies a requested visibility and expiration in the settings: import datetime import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") expires = datetime.datetime.now() + datetime.timedelta(days=30...
Use putAll to put every member of one map into another. Keys already present in the map will have their corresponding values overwritten. Map<String, Integer> numbers = new HashMap<>(); numbers.put("One", 1) numbers.put("Three", 3) Map<String, Integer> othe...
This example shows how to use the IBM Watson Speech to Text service to recognize the type of an audio file and produce a transcription of the spoken text in that file. This example requires Speech to Text service credentials and Node.js Install the npm module for the Watson Developer Cloud N...
docker run -p "8080:8080" myApp docker run -p "192.168.1.12:80:80" nginx docker run -P myApp In order to use ports on the host have been exposed in an image (via the EXPOSE Dockerfile directive, or --expose command line option for docker run), those ports need to be bound to...
Apple's Reachability class periodically checks the network status and alerts observers to changes. Reachability *internetReachability = [Reachability reachabilityForInternetConnection]; [internetReachability startNotifier];
If you want to graph two series on one graph, you can use the Merge function. This can also be combined with the Series function to manipulate the Y axis (like forcing it to start at zero). template graph.template { subject = ... body = `{{template "header" .}} <stro...
The & operator will perform a binary AND, where a bit is copied if it exists in both operands. That means: # 0 & 0 = 0 # 0 & 1 = 0 # 1 & 0 = 0 # 1 & 1 = 1 # 60 = 0b111100 # 30 = 0b011110 60 & 30 # Out: 28 # 28 = 0b11100 bin(60 & 30) # Out: 0b11100
The | operator will perform a binary "or," where a bit is copied if it exists in either operand. That means: # 0 | 0 = 0 # 0 | 1 = 1 # 1 | 0 = 1 # 1 | 1 = 1 # 60 = 0b111100 # 30 = 0b011110 60 | 30 # Out: 62 # 62 = 0b111110 bin(60 | 30) # Out: 0b111110
The ^ operator will perform a binary XOR in which a binary 1 is copied if and only if it is the value of exactly one operand. Another way of stating this is that the result is 1 only if the operands are different. Examples include: # 0 ^ 0 = 0 # 0 ^ 1 = 1 # 1 ^ 0 = 1 # 1 ^ 1 = 0 # 60 = 0b1111...
The << operator will perform a bitwise "left shift," where the left operand's value is moved left by the number of bits given by the right operand. # 2 = 0b10 2 << 2 # Out: 8 # 8 = 0b1000 bin(2 << 2) # Out: 0b1000 Performing a left bit shift of 1 is equivalent ...
The >> operator will perform a bitwise "right shift," where the left operand's value is moved right by the number of bits given by the right operand. # 8 = 0b1000 8 >> 2 # Out: 2 # 2 = 0b10 bin(8 >> 2) # Out: 0b10 Performing a right bit shift of 1 is equivalent...
The ~ operator will flip all of the bits in the number. Since computers use signed number representations — most notably, the two's complement notation to encode negative binary numbers where negative numbers are written with a leading one (1) instead of a leading zero (0). This means that if you w...
To instantiate Foldable you need to provide a definition for at least foldMap or foldr. data Tree a = Leaf | Node (Tree a) a (Tree a) instance Foldable Tree where foldMap f Leaf = mempty foldMap f (Node l x r) = foldMap f l `mappend` f x `mappend` foldMap f r fo...
Implementations of traverse usually look like an implementation of fmap lifted into an Applicative context. data Tree a = Leaf | Node (Tree a) a (Tree a) instance Traversable Tree where traverse f Leaf = pure Leaf traverse f (Node l x r) = Node <$> traverse f l <*...
The accessibility frame is used by VoiceOver for hit testing touches, drawing the VoiceOver cursor, and calculating where in the focused element to simulate a tap when the user double-taps the screen. Note that the frame is in screen coordinates! myElement.accessibilityFrame = frameInScreenCoordina...
VoiceOver can navigate many apps on iOS because most UIKit classes implement UIAccessibilityProtocol. Features that don’t represent onscreen elements using UIView, including apps that leverage Core Graphics or Metal to perform drawing, must describe these elements for accessibility. As of iOS 8.0, t...
git bisect allows you to find which commit introduced a bug using a binary search. Start by bisecting a session by providing two commit references: a good commit before the bug, and a bad commit after the bug. Generally, the bad commit is HEAD. # start the git bisect session $ git bisect start ...
Stability in sorting means whether a sort algorithm maintains the relative order of the equals keys of the original input in the result output. So a sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input unsorted a...
First, some terminology: argument (actual parameter): the actual variable being passed to a function; parameter (formal parameter): the receiving variable that is used in a function. In Python, arguments are passed by assignment (as opposed to other languages, where arguments can be passed by...
Just execute lsb_release -a. On Debian: $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux testing (stretch) Release: testing Codename: stretch On Ubuntu: $ lsb_release -a No LSB modules are available. Distributor ID: Ubun...

Page 2 of 29