sfu-natlang / lensingwikipedia

Lensing Wikipedia is an interface to visually browse through human history as represented in Wikipedia. This the source code that runs the website:
http://lensingwikipedia.cs.sfu.ca
Other
11 stars 4 forks source link

wikipediahistory.js Problem #100

Closed ramtinms closed 10 years ago

ramtinms commented 10 years ago

I am trying to run a local version of site on my laptop. I clone from the Master branch and compile the code using Makefile (Using devel option) and set the backend query server.

I am facing a problem with parsing results of query and the problems is in the wikipediahistory.js file (error : "Cannot call method 'split' of undefined") and when I compare it to the online website , it seems that this file is really different.

theq629 commented 10 years ago

We just merged all the domain code, which makefile did you use? Probably the live site is still from before the merge.

ramtinms commented 10 years ago

I am using the final version of Make file in the master branch (after merging) (Hash Code : 121b3d6) in the frontend directory.

ramtinms commented 10 years ago

Sry I am using cd3fa43 , but I have "prepareReplacements is not defined " in wikipediahistory.js file

theq629 commented 10 years ago

Use the makefiles in domains/ now, the one in frontend/ expects the config files to be setup in the same directory. Although I'm not sure exactly why you are getting that error instead of it not finding the config.

ramtinms commented 10 years ago

The problem changed to "Cannot call method 'split' of undefined" , is it the final structure or is it going to change?

theq629 commented 10 years ago

The general code structure should be fixed now. Did you do a fresh checkout, or is there any chance you have old config files around? If you were able to run the makefile in frontend/ at all I think it might be using the wrong code.

ramtinms commented 10 years ago

I did a fresh checkout and clone in new directory. I don’t have any file from past in that directory

Ramtin Mehdizadeh Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Friday, 21 February 2014 at 00:05, Max Whitney wrote:

The general code structure should be fixed now. Did you do a fresh checkout, or is there any chance you have old config files around? If you were able to run the makefile in frontend/ at all I think it might be using the wrong code.

— Reply to this email directly or view it on GitHub (https://github.com/sfu-natlang/lensingwikipedia/issues/100#issuecomment-35706694).

theq629 commented 10 years ago

What about the backend and data? Any chance that the frontend is getting old data (especially pre-#95)?

ramtinms commented 10 years ago

I changed the server config to http://lensingwikipedia.cs.sfu.ca/ , (according to wireshark) it is receiving the data but the front-end gets error for split() function, Maybe it is a problem with Chrome Browser.

anoopsarkar commented 10 years ago

the website.md file contains the instructions. although it may need to be updated

theq629 commented 10 years ago

It looks like website.md hasn't been updated for either the config file refactoring or the move to domains/, but frontend/README should be current. The main changes are:

ramtinms commented 10 years ago

The main problem with offline version is that on our current version , cross-site HTTP requests are not accepted (When using browsers). So we can not receive informations from back-end servers when using browsers but it is accessible by using terminal.

The solution is to add to the back-end header response. Access-Control-Allow-Origin: *

But the question is that is it Ok to make this change and change the access control for cross-site HTTP requests, in other words is it okey to let other sites to send a query to our back-end?

more information in : https://developer.mozilla.org/en/docs/HTTP/Access_control_CORS

Ramtin Mehdizadeh

On Friday, 21 February 2014 at 08:27, Max Whitney wrote:

It looks like website.md (http://website.md) hasn't been updated for either the config file refactoring or the move to domains/, but frontend/README should be current. The main changes are: Run the appropriate makefile in domains/ instead of in frontend/ directly. No configuration is strictly required now, but in general you'd want to set backendUrl. The simplest way is to run the makefile once and then edit frontendsettings.js.

— Reply to this email directly or view it on GitHub (https://github.com/sfu-natlang/lensingwikipedia/issues/100#issuecomment-35746529).

anoopsarkar commented 10 years ago

@ramtinms to clarify: you are running the frontend on a different machine from the backend and this is the issue?

where does one add that header to allow cross-site requests? is it in the httpd conf files for natlang-web.cs.sfu.ca or in the python code that issues queries?

ramtinms commented 10 years ago

Yes
I think it can be done in python code in backend.

Ramtin Mehdizadeh

On Tuesday, 25 February 2014 at 11:50, Anoop Sarkar wrote:

@ramtinms (https://github.com/ramtinms) to clarify: you are running the frontend on a different machine from the backend and this is the issue?
where does one add that header to allow cross-site requests? is it in the httpd conf files for natlang-web.cs.sfu.ca (http://web.cs.sfu.ca) or in the python code that issues queries?

— Reply to this email directly or view it on GitHub (https://github.com/sfu-natlang/lensingwikipedia/issues/100#issuecomment-36049956).

anoopsarkar commented 10 years ago

I think we can allow this. @theq629 do you see any problems?

theq629 commented 10 years ago

That's fine as long as you are ok with the security for that.

However, I am currently able to use the live backend from a site hosted on my laptop. I get the same split error, which is happening because the live backend is not providing the eventSpan. Presumably the current live site is from before the changes at #95.

theq629 commented 10 years ago

Also, isn't the cross site access control at least partially on the browser side too? If I remember correctly I get errors for that if I load the site from file://, but not if I serve it locally and access it as http://.

ramtinms commented 10 years ago

I think If there is no cross site access control flag on the header of the response from server packet , Browsers ( I checked google chrome) will not let you access the data.
For the browser side I am using MAMP for local virtual hosting and this command to permit my chrome to work with cross site access control flag :
open -a 'Google Chrome' --args -allow-file-access-from-files

but I still get "No 'Access-Control-Allow-Origin' header is present on the requested resource.” error log in chrome.

Ramtin Mehdizadeh

On Tuesday, 25 February 2014 at 17:11, Max Whitney wrote:

Also, isn't the cross site access control at least partially on the browser side too? If I remember correctly I get errors for that if I load the site from file://, but not if I serve it locally and access it as http://.

— Reply to this email directly or view it on GitHub (https://github.com/sfu-natlang/lensingwikipedia/issues/100#issuecomment-36079877).

theq629 commented 10 years ago

Ok, in that case we should probably have an option to add the header. Isn't this a separate issue, though? If you are getting as far as the split error I'm pretty sure it is getting data from the backend.

anoopsarkar commented 10 years ago

@ramtinms can we close this issue? or is it still unresolved?

ramtinms commented 10 years ago

For now it is solved but I think we need to design a better structure for different domains that can be a new topic.

Ramtin Mehdizadeh Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Sunday, 16 March 2014 at 06:13, Anoop Sarkar wrote:

@ramtinms (https://github.com/ramtinms) can we close this issue? or is it still unresolved?

— Reply to this email directly or view it on GitHub (https://github.com/sfu-natlang/lensingwikipedia/issues/100#issuecomment-37756718).