Название: Algorithms For Dummies
Автор: John Paul Mueller
Издательство: John Wiley & Sons Limited
Жанр: Программы
isbn: 9781119870005
isbn:
The other reason that you really need to know about Colab is that you can use it with your alternative device. During the writing process, some of the example code was tested on an Android-based tablet (an ASUS ZenPad 3S 10). The target tablet has Chrome installed and executes the code well enough to follow the examples. All this said, you likely won’t want to try to write code using a tablet of that size — the text was incredibly small, for one thing, and the lack of a keyboard could be a problem, too. The point is that you don’t absolutely have to have a Windows, Linux, or OS X system to try the code, but the alternatives might not provide quite the performance you expect.
Google Colab generally doesn’t work with browsers other than Chrome (the browser used in this chapter), Firefox, or Safari (initial tests with Microsoft Edge have also been encouraging). In most cases, you see an error message, such as
This site may not work in your browser. Please use a supported browser
, and no other display if you try to start Colab in a browser that it doesn’t support. The included More Info link takes you to https://research.google.com/colaboratory/faq.html#browsers
, where you can learn more information.
SOME FIREFOX ODDITIES
Even with online help, you may still find that your copy of Firefox displays a SecurityError: The operation is insecure.
error message. The initial error dialog box points to some unrelated issue, such as cookies, but you see this error message when you click Details. Simply dismissing the dialog box by clicking OK makes Colab appear to be working because it displays your code, but you won't see results from running the code.
As a first step toward fixing this problem, make sure that your copy of Firefox is current; older versions don’t provide the required support. After you've updated your copy, setting the network.websocket.allowInsecureFromHTTPS
preference using About:Config
to True
should resolve the problem, but sometimes it doesn't. In this case, verify that Firefox actually does allow third-party cookies by selecting both the Always for the Accept Third Party Cookies and Site Data option and the Remember History option in the History section on the Privacy & Security tab of the Options dialog box. Restart Firefox after each change and then try Colab again. If none of these fixes works, you must use Chrome to work with Colab on your system.
Getting familiar with Google Colab features
Google Colab provides access to a number of features through the menu system. One of these features, hardware acceleration, appears in the “Using Hardware Acceleration” section, later in this chapter. The features in this section all appear on the Tools menu.
Locating commands
The Tools ⇒ Command Palette option displays a list of commands you can execute, as shown in Figure 3-1. Some of these commands also have shortcut keys, such as Ctrl+Alt+M for adding a comment to a cell. All these commands help you to perform tasks associated with Notebook content, such as adding forms.
FIGURE 3-1: Using Colab commands makes configuring your Notebook easy.
Configuring settings
The Tools ⇒ Settings option displays the Settings dialog box, shown in Figure 3-2. The four settings tabs perform these tasks:
Site: Configures how the site works. The most interesting setting is the theme. Selecting Adaptive lets Colab choose the interface colors based on lighting conditions. You can also configure display and access settings on this tab.
Editor: Determines how text appears onscreen and how the interface works. For example, you can set the key bindings to work like those in Vim (a text editor included on Unix and Linux systems, generally as the vi utility; see https://www.vim.org/
) if desired. You can also select font size, spaces for each level of indentation, and a plethora of other settings.
Colab Pro: Provides an advertisement for Colab Pro (https://colab.research.google.com/signup
), which gives you some significant benefits like faster GPUs, longer runtimes, and more memory — all of which let you get more work done in a shorter time.
Miscellaneous: Contains fun settings. You can choose from three visual effects: adding thunder and lightning using the Power Level setting; letting a Corgi run across the top of the display; and allowing a kitten to run across the top of the display. You can choose any mix of these visual effects.
FIGURE 3-2: The Settings dialog box helps you configure the Colab IDE.
Customizing keyboard shortcuts
If you don’t like the default keyboard shortcuts, you can customize them to match your needs. To do so, choose Tools ⇒ Keyboard Shortcuts, and you see the Keyboard Preferences dialog box, shown in Figure 3-3. If you see Set Shortcut, it means that the command doesn’t currently have a shortcut, so you can add one if desired. Here’s how you work with shortcuts:
To add or change a shortcut, place the cursor in the box next to the command and press the shortcut key you want to use for that command.
To remove a shortcut, press Delete.
FIGURE 3-3: Customize shortcut keys for speed of access to commands.
Comparing files
Sometimes you need to compare two files to see how they differ. When you select Tools ⇒ Diff Notebooks, Colab opens a new browser tab and shows you two notebooks side by side, as shown in Figure 3-4. These are files selected by random from your Google Drive. To select the files you actually want to work with, click the down arrow next to the file path in each pane. The differences appear onscreen.
FIGURE 3-4: Colab lets you compare two files to see how they differ.