Conventions used
There are a number of text conventions used throughout this book.
Code in text
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Mount the downloaded WebStorm-10*.dmg
disk image file as another disk in your system."
A block of code is set as follows:
resource = { "api_key": "AIzaSyDYKmm85kebxddKrGns4z0", "id": "0B8TxHW2Ci6dbckVwTRtTl3RUU", "fields": "files(name, id, webContentLink)", }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
#casestudy1.py: Pi calculator from operator import add from random import random from pyspark.sql import SparkSession spark = SparkSession.builder. master("spark://192.168.64.2:7077") \ .appName("Pi claculator app") \ .getOrCreate() partitions = 2 n = 10000000 * partitions def func(_): x = random() * 2 - 1 y = random() * 2 - 1 return 1 if x ** 2 + y ** 2 <= 1 else 0 count = spark.sparkContext.parallelize(range(1, n + 1), partitions).map(func).reduce(add) print("Pi is roughly %f" % (4.0 * count / n))
Any command-line input or output is written as follows:
Pi is roughly 3.141479
Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: "As mentioned earlier, Cloud Shell comes with an editor tool that can be started by using the Open editor button."
Tips or important notes
Appear like this.