Exercise Sheet 7
The rules for uploading are the same as always. If you forgot them, you can read them again here.
Your solutions (files can only be read by the uploader and by us)
No. |
Name |
Solution (PDF) |
Code (ZIP or TGZ) |
1 |
|||
2 |
|||
3 |
|||
4 |
|||
4 |
|||
6 |
|||
7 |
|||
8 |
|||
9 |
|||
10 |
|||
11 |
|||
12 |
- |
||
13 |
- |
||
14 |
|||
15 |
|||
16 |
|||
17 |
- |
||
18 |
|||
19 |
|||
20 |
|||
21 |
|||
22 |
These were the questions and comments on Exercise Sheet 7
Hi Dragos + all, it is ok to treat them as one. Hannah 8Dec09 14:07
Is it OK to have treated exercises 2-4 as one?(provide the same html, css, js file for all) or should we split it in 3 ? Dragos 8Dec09 10:53
Hi Claudius + all, I mean the total size of all the inverted lists for the completions of the given prefix. Hannah 7Dec09 17:58
In Exercise 1, what do you mean with "total size of the inverted lists"? The size of all terms in the whole index or only the size of all terms, matching the prefix? Claudius 7Dec09 17:20
Hi Björn, any simple solution for this case is ok. That is, either ignore it, or introduce a cut-off value of, say, 100 or 500, and only return that many completions at most. Hannah 7Dec09 13:29
To Björn + all: At least I don't see a big problem here. Short prefixes like "a" do not make much sense anyway and will return a large fraction of all documents in the collection. Still, there is a chance that a higher authority does not agree with me Marjan 7Dec 11:59
There are prefixes (1 char) that return far over 50K results / completions. Although the query is answered within milliseconds (if i look at what firebug says), firefox just does not seem to execute the javascript (or refuse to render the site... i can't tell at the moment). Anyways, while some prefixes, like "q", work. Others, like "a", don't. A result will only apear once I enter a second char (and make it "an", "ab" or something) in those cases. Do I have to worry or try top find a fix, or can ignore that to get points? For the other steps (esp. ex 4), I don't think it makes sense to restrict the number of returned completions. If I had to solve it for a "real" application I might want to make my server provide many services (show x hits, and show the x hits relevant for the correct sorting of the table, etc). If we don't have to do something like this, I would like to avoid the effort for the exercise. Björn 7.12. 11:07
Spplamental: Suddenly, it works with IE as well... Even the find-statements. Oh glorious java-god, who art in heaven, why have you brought us this freakin' language...? Marius 12/06/2009 10:19 p.m.
Hi, it is remarkable, too, that IE seems to have some problems with even performing the $.GET command. After I spent hours to get my Webserver to return the HTML and script-files as well as to handle the prefix request (because of the OPTIONS-HTTP-request that was sent by firefox but worked very well with IE), IE now seems to be unwilling to perform the request (JScript-error: "Schnittstelle nicht unterstützt."). I hope, FF won't have any problems from now on... Marius 12/06/2009 09:52 p.m.
Hi Florian, sure, creative solutions are always welcome, but if you ask me an xsl stylesheet is significantly more work then parsing the xml with jQuery. But as you like. Hannah 6Dec 21:21
Can we use a xsl tranformation to get the html table out of our xml result? Florian 6Dec09 21:08
Yes the backend is also a/ the http server. Johannes 2009-12-06T2047L
Hi Johannes, how do you communicate with the backend then (the program that provides the contents for the table)? Is that also part of your java server, that is, does it play the role of a web server and a backend simultaneously? That would be one way of doing it, too. Hannah 6Dec09 16:49
Just let your java server provide the css, js and html too. Works for me and is easy to do in java. Johannes 2009-12-06T1114L
I didn't know that jQuery's find does not work on Internet Explorer, and I am actually surprised to hear that. It somewhat shatters my previous belief that jQuery just works on any of the major browsers (all of which implement JavaScript a little differently, which makes the use of raw JavaScript so cumbersome). I will try to find(!) out why that is so. Sorry, if you had trouble because of this, but well, that's (web application writing) life. Hannah 6Dec09 0:26
In the lecture, all the files prefix-search.html, prefix-search.js, prefix-search.css, and prefix-search.php were served by an Apache web sever running on one and the same machine stromboli.informatik.uni-freiburg.de. The $.(get) in the prefix-search.js was sending the query to the prefix-search.php. As Björn pointed out, Firefox asks that the html (which is what the user loads by typing the URL or clicking a link, and which in turn loads the js) be served via port 80 by a machine on the same domain as the prefix-search.php. For our machine domain refers to uni-freiburg.de, that is, the php could have been located on any other machine with a URL ending in uni-freiburg.de, too. Otherwise, you get a so-called cross-scripting error. This is *not* part of the JavaScript standard, however, and different browsers implement it differently. This is also what Manuela found. I leave it to you how you get around the cross-scripting problem. The preferred solution is to have all files served by web servers on machine on the same domain, as just explained. If you find other solutions that work, that is also fine, but please explain what led you to this solution, just like Manuela did below. Hannah 06Dec09 0:22
From what a fellow student told me in the lecture (thanks, alex) the problem with GETing the javascript comes from the fact that (for security issues) the HttpXmlRequest is only allowed be send to a ressource on the same domain that you got the HTML from. Firefox turns it into an OPTIONS request. This might also be the reason why it worked in the lecture where the html and the php were both served by the same apache, but does not work if your html is not on the apache, too (Also explains the observations posted below). Personally, I'm planning on letting my webserver provide all, the html, css, js (by letting it return files from a subfolder depending on the path in the GET request) and the xml if the GET request does not start with a prefix for that folder. Otherwise it should work if you do it just as we did in the lecture and have HTML (+ css + js) and PHP in your apache's folder. I haven't started yet but I can let you know if this works for me. Anyway, IF it does, credit goes to Alexander Gutjahr who told about this javascript issue, of course. Björn 05Dec 22:12
I'm a bit confused about the exercise. For exercise 1 I extended the Java webserver from exercise sheet 2 with the prefix search of the last exercise sheet. The webserver returns the results of the prefix search as a XML document. Should I have used an webserver like apache? But I also had some problems with sending the JQuery request to the server. The webserver runs on port 80. I started with Firefox. Firefox sends an OPTIONS request to the server and so the JQuery get-function doesn't work. The same happend as I used Google Chrome. Because the Java webserver can't handle PHP I can't do it like in the lecture. So I tried Internet Explorer and this browser sends a GET request by using the JQuery get-function. I assumed I can follow with the exercise, but though I did it like in the lecture, nothing happend. I used the alert-function to check that I really get the XML document from the server (and I got it). Now I know, that the find-function doesn't work with Internet Explorer. After this I tried Safari. Safari sends a GET-request and also the find-function works. Now I can follow and build the tables like described on the exercise sheet. Is it OK to go on like that? Manuela 05Dec09 19:24
Hi Alex, can you be more specific about what exactly did not work for you and what you had to do to make it work? In particular, what do you mean by "the server directory"? Do you mean apache's document root? Then where have your files been before? In a subdirectory of the root? And what do you mean by a GET request being turned into an OPTIONS request, and how did you arrive at the conclusion that this is what happens? It should not matter if the .php file is in a different directory than the .js file. My feeling is that your problem lies elsewhere, but it's hard to tell from the information you gave so far. Hannah 05Dec09 18:02
@whom it may concern: for me the access-rights stuff did not work exactly as in the lecture - i had to move the whole site (.html .js ...) into the server directory. Maybe it's new to firefox 3.5 but i could not access any file on the server from a .js not being in the server directory - it always turned my GET-Requests into OPTIONS-Requests and nothing was returned - so the php-solution does not seem to work, even if my server was able to execute php. Were we supposed to do it like this anyway or is it completely wrong this way?.. alex 5Dec09 17:56
Ok, the recording of Lecture 7 is now available as AVI. But beware, it's quite big: around 300 MB. Hannah 3Dec09 22:46
To play the .camrec recording you need the full Camtasia Studio (you can download a 30-day test version if you want). I will soon upload an .avi version instead. Hannah 3Dec09 21:56
For your reference and convenience, here is a tar archive of the files which we wrote together in Lecture 7 (prefix-search.html, prefix-search.css, prefix-search.js, prefix-search.php). Hannah 3Dec09 21:35