Tutorial by Examples: er

All these are shell commands. docker-machine env to get the current default docker-machine configuration eval $(docker-machine env) to get the current docker-machine configuration and set the current shell environment up to use this docker-machine with . If your shell is set up to use a proxy, yo...
All these are shell commands If you need to log onto a running docker-machine directly, you can do that: docker-machine ssh to ssh into the default docker-machine docker-machine ssh machinename to ssh into a non-default docker-machine If you just want to run a single command, you can do so...
The following code is based on the examples provided by the documentation on std::net::TcpListener. This server application will listen to incoming requests and send back all incoming data, thus acting as an "echo" server. The client application will send a small message and expect a reply...
prop_evenNumberPlusOneIsOdd :: Integer -> Property prop_evenNumberPlusOneIsOdd x = even x ==> odd (x + 1) If you want to check that a property holds given that a precondition holds, you can use the ==> operator. Note that if it's very unlikely for arbitrary inputs to match the precondit...
One can iterate over a list using ~{ and ~} directives. CL-USER> (format t "~{~a, ~}~%" '(1 2 3 4 5)) 1, 2, 3, 4, 5, ~^ can be used to escape if there are no more elements left. CL-USER> (format t "~{~a~^, ~}~%" '(1 2 3 4 5)) 1, 2, 3, 4, 5 A numeric argument can ...
Assumptions: An Oracle JDK has been installed. The JDK was installed to the default directory. Setup steps Open Windows Explorer. In the navigation pane on the left right click on This PC (or Computer for older Windows versions). There is a shorter way without using the explorer in...
Array iteration comes in two flavors, foreach and the classic for-loop: a=(1 2 3 4) # foreach loop for y in "${a[@]}"; do # act on $y echo "$y" done # classic for-loop for ((idx=0; idx < ${#a[@]}; ++idx)); do # act on ${a[$idx]} echo "${a[$idx]}&...
Ruby extends the standard group syntax (...) with a named group, (?<name>...). This allows for extraction by name instead of having to count how many groups you have. name_reg = /h(i|ello), my name is (?<name>.*)/i #i means case insensitive name_input = "Hi, my name is Zaphod Be...
Syntax {condition-to-evaluate} ? {statement-executed-on-true} : {statement-executed-on-false} As shown in the syntax, the Conditional Operator (also known as the Ternary Operator1) uses the ? (question mark) and : (colon) characters to enable a conditional expression of two possible outcomes. It c...
You can use the reversed function which returns an iterator to the reversed list: In [3]: rev = reversed(numbers) In [4]: rev Out[4]: [9, 8, 7, 6, 5, 4, 3, 2, 1] Note that the list "numbers" remains unchanged by this operation, and remains in the same order it was originally. To r...
Create a receiver. This class will receive the intent and handle it how you wish. public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // Handle intent int reqCode = intent.getExtras().getInt(&...
(loop for i in '(one two three four five six) do (print i)) (loop for i in '(one two three four five six) by #'cddr do (print i)) ;prints ONE THREE FIVE (loop for i on '(a b c d e f g) do (print (length i))) ;prints 7 6 5 4 3 2 1 (loop for i on '(a b c d e f g) by #'cddr ...
(defvar *ht* (make-hash-table)) (loop for (sym num) on '(one 1 two 2 three 3 four 4 five 5 six 6 seven 7 eight 8 nine 9 ten 10) by #'cddr do (setf (gethash sym *ht*) num)) (loop for k being each hash-key of *ht* do (print k)) ; iterate over the keys (loop for k ...
(loop for s being the symbols in 'cl do (print s)) (loop for s being the present-symbols in :cl do (print s)) (loop for s being the external-symbols in (find-package "COMMON LISP") do (print s)) (loop for s being each external-symbols of "COMMON LISP" ...
You should implement SFSafariViewControllerDelegate so that your class is notified when the user hits the Done button on the SafariViewController and you can dismiss it as well. First declare your class to implement the protocol. class MyClass: SFSafariViewControllerDelegate { } Implement th...
Don't forget to import the necessary framework first. import SafariServices //Objective-C @import SafariServices; Instantiate a SafariViewController instance. let safariVC = SFSafariViewController(URL: URL(string: "your_url")!) //Objective-C @import SafariServices; NSURL *URL = [...
Considering the following dictionary: d = {"a": 1, "b": 2, "c": 3} To iterate through its keys, you can use: for key in d: print(key) Output: "a" "b" "c" This is equivalent to: for key in d.keys(): print(key) ...
if /hay/ =~ 'haystack' puts "There is hay in the word haystack" end Note: The order is significant. Though 'haystack' =~ /hay/ is in most cases an equivalent, side effects might differ: Strings captured from named capture groups are assigned to local variables only when Regexp#=~...
Say you have a library website, and you want to have a custom post type named Books. It can be registered as function create_bookposttype() { $args = array( 'public' => true, 'labels' => array( 'name' => __( 'Books' ), 'singular_name' => ...
Dim filename As String = "c:\path\to\file.txt" If System.IO.File.Exists(filename) Then Dim writer As New System.IO.StreamWriter(filename) writer.Write("Text to write" & vbCrLf) 'Add a newline writer.close() End If

Page 54 of 417