sanskrit-lexicon / csl-pywork

A template for creating pywork repository for each dictionary.
3 stars 1 forks source link

local csl-apidev #11

Closed funderburkjim closed 3 years ago

funderburkjim commented 4 years ago

The csl-apidev repository contains

This issue describes

funderburkjim commented 4 years ago

pre-requisites for installation

It is assumed that a local php server is available and that one or more dictionaries have been installed locally under a 'cologne' directory. Currently, the best installation instructions are here.

It is not necessary that all the Cologne dictionaries be installed locally; applications built on top of the local installation will be able to use dictionary data only for those dictionaries that are installed.

For these applications to use local scanned images, these images will also need to be installed locally; currently, an indication of how to install local images is given in #10.

funderburkjim commented 4 years ago

installation of csl-apidev

In a terminal, change to the cologne directory, under which all the dictionaries and scanned images are located.

Then, clone the csl-apidev repository:

git clone https://github.com/sanskrit-lexicon/csl-apidev.git

For some installations (e.g. on hosted Ubuntu servers), you may need to change permissions; this is an area of confusion to me. But on local XAMPP installations under Windows 10, permissions shouldn't be a problem.

funderburkjim commented 4 years ago

Using local simple-search application

Under XAMPP installation with Windows 10, the simple-search application url is: http://localhost/cologne/csl-apidev/simple-search/v1.0/list-0.2s_xampp.html

This should function just like the simple-search at Cologne. But it will use locally installed data.

E.g., for mw dictionary, it will use database /cologne/mw/web/sqlite/mw.sqlite.

For some features, local versions are used if installed, and Cologne server versions are used otherwise.

For example, with the scanned image feature, local images are used if they are installed; otherwise, images are fetched from Cologne server.

funderburkjim commented 4 years ago

@YevgenJohn

That last sentence is not yet true -- i.e., the csl-apidev code does not know about the local installation location cologne/scans/xxx/pdfpages . (You can test this, analogous to the csl-websanlexicon test mentioned in #10.)

An exercise for you is to make the (I think easy) change to the csl-apidev code, so that local images will be used if present in the local installation location mentioned above.

YevgenJohn commented 4 years ago

Understood, checking this out. I had no issues with permission on XAMPP.

YevgenJohn commented 4 years ago

Under XAMPP installation with Windows 10, the simple-search application url is: http://localhost/cologne/csl-apidev/simple-search/v1.0/list-0.2s_xampp.html

This functionality doesn't work for me. I see in the code several URL like localhost/cologne/apidev/, while I guess it needs to be csl-apidev (or symlinked), which doesn't work even after I changed URL in few places there. Keep digging, php is my less skillset that python.

YevgenJohn commented 4 years ago

This functionality doesn't work for me. I see in the code several URL like localhost/cologne/apidev/, while I guess it needs to be csl-apidev (or symlinked), which doesn't work even after I changed URL in few places there. Keep digging, php is my less skillset that python.

Once symlink created dictionary list started populating, it means apidev is hardcoded in so many other places, so it needs to be: ln -s csl-apidev apidev

YevgenJohn commented 4 years ago

The change was trivial: https://github.com/sanskrit-lexicon/csl-apidev/commit/d99c067a313762d4398713f9cb5d4c21cb445388 as I just modeled it after already implemented one in: https://github.com/sanskrit-lexicon/csl-websanlexicon/commit/b54042cd7d99c2d5e4ee1de723f88cacda8697bd#diff-f3280e6c850d34602d60bc10dbbb8437

I see the reference to the localhost for AE when using http://localhost/cologne/csl-apidev/simple-search/v1.0/list-0.2s_xampp.html: <embed id="plugin" type="application/x-google-chrome-pdf" src="http://localhost/cologne/scans/ae/pdfpages/ae-119.pdf"

funderburkjim commented 4 years ago

I see in the code several URL like localhost/cologne/apidev/ ...

Good catch.

The problem arises because originally (on COlogne server) I used 'apidev'. Then, when making a repository, I thought the repository name should be consistent with the 'csl-' convention, so named the repository csl-apidev.

solution

The only material references in v1.0 to 'apidev' occur in 'list-0.2s_xampp.html' (found via grep). I changed all these in list-0.2s_xampp.html from absolute to relative urls. This seems to solve the problem. This is commit #8cf4d58. Note: No need for symlink now -- go ahead and remove the symlink, sync your csl-apidev to github, set your browser to url=http://localhost/cologne/csl-apidev/simple-search/v1.0/list-0.2s_xampp.html, and see if it works ok for you.

local images

Your solution seems fine -- local image used when dictionary=ae, for 'dog' and also 'cat'. Thank you!

funderburkjim commented 4 years ago

comment on your commit

I found something not quite right related to your commit d99c067 for the 'Modification for the local scans lookup': image

The solution itself is fine. The problems are where indicated in above picture.

The first problem is that it says 'root committed', not 'YevgenJohn commited', and second is that it says '6 days ago', when you only did it today!

Not sure of solution -- probably something about your local git installation ?

YevgenJohn commented 4 years ago

It asks my user's credentials when I push it to the server, but using VM user and time. Thank you for catching that, I'll need to setup Git config in the local VM, and probably configure NTP. That can be included into the installer script which populates VM when installing from scratch. Thank you!

funderburkjim commented 4 years ago

Just out of curiosity, what is your VM, and what is your VM running on (e.g. Ubuntu 18 on Virtualbox)?

YevgenJohn commented 4 years ago

Just out of curiosity, what is your VM, and what is your VM running on (e.g. Ubuntu 18 on Virtualbox)?

It's bare Centos7 installation on VirtualBox.

gasyoun commented 4 years ago

simple-search

Jim killed the Dec 2017 link, hurray.