Web Log Stats Lesson 8
Suppose it's time to go home or there's a major thunderstorm outside and
power could go off at any minute.
It's time to save your work - you certainly don't want to lose it.
This lesson shows a simple way to save your work, exit VisualWorks and later retrieve
what you've saved.
If the System Browser is open, select it. If not, from the main VisualWorks Launcher
window, launch the System Browser by either clicking the fourth button on the
Toolbar or selecting the menu option Browse >> System.
2. In the package pane (furthest left) scroll all the way down to the bottom of the package list, then scroll up. You should now see a new package called WebLogStats.
3. Highlight (select) the WebLogStats package, <Operate-Click> and select File Out As..
You should see a window that looks like the following:
Figure 8-1. The <Operate-Click> menu for our Package
4. A native "Save File" dialog box should appear (the one below is WindowsXP):
Figure 8-2. The (WindowsXP) "File Out As" dialog box
VisualWorks will use the name of the Package, in our case WebLogStats and append the suffix ".st" to it to create a default name.
5. Click the button that will save the file (in this case Save).
VisualWorks will default to the VisualWorks "default directory" for saving your code. The suffix of ".st" stands for "Smalltalk" and the file itself is in XML format.
6. Close all VisualWorks windows and exit VisualWorks. From the main VisualWorks Launcher window, select the menu option File >> Exit VisualWorks... When questioned if you want to exit VisualWorks, choose Exit without Saving.
7. Relaunch VisualWorks. Open the File List window (from the main VisualWorks Launcher window, select the menu option File >> File Browser or the icon with the folders and eyeglasses on the toolbar. A dialog box will appear like the one below:
Figure 8-3. The File Browser dialog box
8. In the top text box, enter an asterisk (*.st) and press "Enter" or "Return".
VisualWorks will refresh the list of files for the current default directory. Your list of files will vary from the one pictured below. Your dialog box will appear something like the one below:
Figure 8-4. The File List dialog box refreshed with the wildcard and "st"
9. In the top pane on the right, the WebLogStats.st file appears. Highlight (select) this file.
VisualWorks will display the contents of this file in the bottom pane.
Figure 8-5. The contents of our "st" file in the File List dialog box
10. With the WebLogStats.st file highlighted (selected), <Operate-Click> and chose File In.
Figure 8-6. The File-In option in the File List dialog box
VisualWorks will load the "st" file and verify the successful retrieval in the Transcript.
Figure 8-7. The "WebLogStats.st" file loaded successfully
11. Launch the System Browser (from the main VisualWorks Launcher window, click either the fourth button on the Toolbar or select the menu option Browse >> System).
12. Scroll all the way down to the bottom of the package list, then up to WebLogStats.
All the code you had before is now back in place. This will verify that VisualWorks successfully saved and loaded your work.
SummaryThis procedure, for obvious reasons, is called "Filing Out / Filing In". It is by far the easiest way of saving and retrieving your work. Not only does it save your code, but all the categories, classes and protocols as well.
In the next lesson, you will add more functionality to our class. Then, if you're in the mood, save it (again).
You now should know how to: