You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
********* typo
1_3 Defining new abstract paths
First a typo: (word 'tryig' should be trying)
******************* confusing point
A warning of a confusing point. I was trying to make ..
"I was tryig to make these 'abstract paths' be abstract files paths for a long time when learning this stuff."
I understand the concept of abstract paths but what do you mean when you talk of 'abstract files'?
************ confusing exercise
Exercise 2: Add a handler that says 'sorry, not here' to 1_3 when you try something like http://127.0.0.1:8000/this/is/invalid
I am trying to add the 404-handler but even after googling a lot I haven't come any further.
I assume that I will have to use http_error and expect to see a stack-trace but even after loading that module, I get a standard page that says that http://127.0.0.1:8000/does/not exist cannot be found.
I only found one example-program (calc.pl) that seems to use http_error.
Can you supply a clue on how to tackle this exercise?
The text was updated successfully, but these errors were encountered:
I'll definitely expand that section of the tutorial.
An 'Abstract file path" is called a 'path alias' at various places in the SWI-Prolog documentation. Admittedly, it's hard to find
documentation of this - I've filed SWI-Prolog bug #156 against that.
Anyway, most places where a file name is called for in SWI-Prolog will take a 'file alias'. For example, when you use library
modules you write
:- use_module(library(lists)).
library(lists) means 'the module lists, which by convention is in the file lists.pl, in the abstract path library. The path library has been defined somewhere by calling file_search_path, which relates an
absolute path to a file alias. So, suppose you are writing a program and want to refer to some test
images that are in the /testimages directory. You could define a path alias
user:file_search_path(test, '/testimages').
and now open one of these images named test0.png with
open(test('test0.png'), read, Stream, [type(binary)])
Now, your coworker's not happy with putting the test images in the root of the file system, and has hers in /home/coworker/test/images. She can change the alias in one place and not have to trace down every reference to the path. BUT, there's an easier way....
the file search path looks through all the paths for the file. So she can just add her configuration to the search
And the system ignores the nonexistant path on her machine, and similarly on yours.
Now later on you get a lot more test images. Nobody wants all those images on their local machine,
so everybody mounts an NFS mount on the server. But people are working on various problems,
and still have local images they want added to the test set.
user:file_search_path(test, '/testimages'). % Ben Engbers path
user:file_search_path(test, ' /home/coworker/test/images'). % Sally Coworker path
user:file_search_path(test, '/mnt/images'). % the image server
these from Ben Engbers
********* typo
1_3 Defining new abstract paths
First a typo: (word 'tryig' should be trying)
******************* confusing point
A warning of a confusing point. I was trying to make ..
"I was tryig to make these 'abstract paths' be abstract files paths for a long time when learning this stuff."
I understand the concept of abstract paths but what do you mean when you talk of 'abstract files'?
************ confusing exercise
Exercise 2: Add a handler that says 'sorry, not here' to 1_3 when you try something like http://127.0.0.1:8000/this/is/invalid
I am trying to add the 404-handler but even after googling a lot I haven't come any further.
I assume that I will have to use http_error and expect to see a stack-trace but even after loading that module, I get a standard page that says that http://127.0.0.1:8000/does/not exist cannot be found.
I only found one example-program (calc.pl) that seems to use http_error.
Can you supply a clue on how to tackle this exercise?
The text was updated successfully, but these errors were encountered: