Home Articles Books Search About
RSS 日本語
Omeka S Module Introduction: HistoryLog - Recording Change History

Omeka S Module Introduction: HistoryLog - Recording Change History

Overview As of 2023/07/20, this module appears to still be in beta, but I had the opportunity to try out “Omeka-S-module-HistoryLog,” a module for recording change history in Omeka S. Here are my notes. https://github.com/Daniel-KM/Omeka-S-module-HistoryLog Installation As noted in the documentation, you may need to install the Generic module beforehand. https://github.com/Daniel-KM/Omeka-S-module-HistoryLog#installation Otherwise, the installation procedure is the same as for standard modules. After installation, the module will appear in the module list as shown below. ...

Updated Mirador to 2.7 in the Omeka Classic IIIF Toolkit

Updated Mirador to 2.7 in the Omeka Classic IIIF Toolkit

Overview I updated Mirador to 2.7 in the Omeka Classic IIIF Toolkit. You can check the source code on the following page. https://github.com/nakamura196/IiifItems You can also download the zip file from the following URL. https://github.com/nakamura196/IiifItems/releases/download/1.1.1/IiifItems-1.1.1.zip What This Enables By using Mirador 2.7, it becomes possible to display images in the viewer even if they do not support the IIIF Image API. This makes it possible to add and manage annotations using Mirador for publicly available images as well. ...

Batch Registering Data to Omeka Classic IIIF Toolkit

Batch Registering Data to Omeka Classic IIIF Toolkit

Overview This article explains how to batch register data to Omeka Classic IIIF Toolkit. For setting up Omeka Classic IIIF Toolkit, please refer to the following: This also builds on the content of the following article, making it easier to use by accepting Excel data as input. Preparing the Excel File Prepare an Excel file like the following: https://github.com/nakamura196/000_tools/blob/main/data/sample.xlsx Create three sheets: “collection,” “item,” and “annotation.” collection manifest_uri https://d1fasenpql7fi9.cloudfront.net/v1/manifest/3437686.json ...

Mirador 3 Plugin Development: Copying a Window

Mirador 3 Plugin Development: Copying a Window

Overview I created a plugin for Mirador 3 that copies a window. Note that this functionality is already provided by the following plugin. https://github.com/ProjectMirador/mirador-plugin-demos Therefore, this plugin was created to learn the plugin development process. I hope this plugin serves as a useful reference from that perspective. Here is a screenshot. The source code is available here. https://github.com/nakamura196/mirador-copy-window-plugin The demo site is available here. https://nakamura196.github.io/mirador-copy-window-plugin/ Development Notes For developing this plugin, I first cloned the following repository and made modifications to it. ...

Trying QuickStatements on wikibase.cloud

Trying QuickStatements on wikibase.cloud

Overview I tried QuickStatements on wikibase.cloud, so here are my notes. I referred to the following article. https://qiita.com/higa4/items/10affb47215def42d8e0 Adding Data Following the article above, I imported a CSV file. However, the following error occurred. The cause was that the required properties were not registered on the independently set up wikibase instance. Property [[Property:P1814|P1814]] not found It turned out that properties (especially those with the same IDs as wikidata) need to be registered in advance using WikibaseSync or similar tools. ...

Trying Out WikibaseSync

Trying Out WikibaseSync

Overview I had the opportunity to try out the following WikibaseSync, so this is a personal note for future reference. https://github.com/the-qa-company/WikibaseSync I learned about this tool from the following paper. https://doi.org/10.11517/jsaisigtwo.2022.SWO-056_04 Installation Install the source code and related libraries. !get clone https://github.com/the-qa-company/WikibaseSync cd WikibaseSync !pip install -r requirements.txt Creating a Bot Account Access the Wikibase prepared in advance, and click “Bot passwords” from “Special pages”. On the following screen, enter the “Bot name”. ...

Using the Wikibase API

Using the Wikibase API

Overview I had the opportunity to use the Wikibase API from a Python client, so this is a memo of the process. I used the following library. https://wikibase-api.readthedocs.io/en/latest/index.html Installation Install with the following: !pip install wikibase-api Read This time, we will work with the following Wikibase instance. https://nakamura196.wikibase.cloud/ from wikibase_api import Wikibase api_url = "https://nakamura196.wikibase.cloud/w/api.php" wb = Wikibase(api_url=api_url) r = wb.entity.get("Q1") print(r) With the above, we were able to retrieve information about Q1. Create Obtaining Authentication Credentials When creating items, authentication needed to be performed using one of the following methods: ...

Trying Dataverse

Trying Dataverse

Overview I had an opportunity to try Dataverse, so here are my notes. I used the following demo environment. https://demo.dataverse.org/ Creating an Account Create an account from Sign Up. Creating a Dataverse Let’s try creating a Dataverse. I created the following Dataverse. https://demo.dataverse.org/dataverse/nakamura196 Creating a Dataset Create a dataset from Add Data. The following is the registration screen. The following is the registration result screen. ...

Trying wikibase.cloud

Trying wikibase.cloud

Overview I had an opportunity to try wikibase.cloud, so here are my notes. Documentation The manual was available at the following link. https://www.mediawiki.org/wiki/Wikibase/Wikibase.cloud Creating an Instance Initially, I tried setting up a custom domain, but it didn’t work. I’ll just leave the record below. From that point on, I gave up on the custom domain and used nakamura196.wikibase.cloud. Failure It appeared that a custom domain could be assigned, so I entered wikibase.aws.ldas.jp. ...

Health Checking Virtuoso Running on Amazon EC2

Health Checking Virtuoso Running on Amazon EC2

Overview I had the opportunity to set up health checks for Virtuoso running on Amazon EC2, so this is a memo of the process. Specifically, when Virtuoso (e.g., https://xxx.zzz/sparql) starts returning errors due to some issue, the details are sent via email notification. Method The following article introduces how to set up a Virtuoso RDF store on Amazon EC2. The above setup uses an ELB. Only one change needs to be made from the above article. The Health check path was set to /, but this should be changed to the path to the SPARQL endpoint (e.g., /sparql). ...

Using the onClose Prop

Using the onClose Prop

When using onBackdropClick in MUI’s Dialog component, the following warning occurred. Warning: Failed prop type: The prop `onBackdropClick` of `ForwardRef(Dialog)` is deprecated. Use the onClose prop with the `reason` argument to handle the `backdropClick` events. The warning message is about the deprecated prop onBackdropClick of the Dialog component. This means that this prop is being used somewhere in your code but is no longer supported or recommended. The warning suggests using the onClose prop instead. ...

Zooming to Meet Viewport Constraints in Mirador 3

Zooming to Meet Viewport Constraints in Mirador 3

Overview To zoom to a specific area in Mirador 3, you can use the method described below. https://github.com/ProjectMirador/mirador/wiki/M3---Mirador-3-Frequently-Asked-Questions#q-how-do-i-change-the-view-of-an-image-to-zoom-to-a-certain-area Specifically, it looks like this. // Box to zoom to const boxToZoom = { x: 1420, y: 1831, width: 800, height: 1195 }; const zoomCenter = { x: boxToZoom.x + boxToZoom.width / 2, y: boxToZoom.y + boxToZoom.height / 2 }; var action = Mirador.actions.updateViewport(windowId, { x: zoomCenter.x, y: zoomCenter.y, zoom: 1 / boxToZoom.width }); miradorInstance.store.dispatch(action); Internally, it appears that OpenSeadragon’s panTo and zoomTo are used. The issue here is that zoomTo ignores constraints when zooming, as described in the following article. ...

Using zoomTo in OpenSeadragon to Satisfy Viewport Constraints

Using zoomTo in OpenSeadragon to Satisfy Viewport Constraints

After using the zoomTo method in OpenSeadragon, you can call viewport.applyConstraints() to ensure the viewport is adjusted to satisfy the configured constraints. This is useful when zoom or pan operations exceed the viewport constraints. Here is an example: // `viewer` is an OpenSeadragon instance const zoomLevel = 2.0; viewer.viewport.zoomTo(zoomLevel); viewer.viewport.applyConstraints(); In the code above, we first set the viewport zoom level to a specified value. Then, by calling the applyConstraints method, the viewport is adjusted to satisfy its constraints. In other words, if the specified zoom level exceeds the configured constraints, the zoom level will be adjusted to fit within those constraints. ...

Difference Between `fitBounds` and `fitBoundsWithConstraints` in OpenSeadragon (OSD)

Difference Between `fitBounds` and `fitBoundsWithConstraints` in OpenSeadragon (OSD)

(The following is a response from ChatGPT. I hope it serves as a helpful reference.) The difference between fitBounds and fitBoundsWithConstraints in OpenSeadragon (OSD) lies in whether or not constraints are applied. OSD is a JavaScript library with advanced zoom and panning capabilities, used for handling deeply zoomable images and content. Among its methods, fitBounds and fitBoundsWithConstraints are used to fit the viewport (display area) to specific bounds. fitBounds(rectangle, immediately): Fits the viewport to the specified rectangle. If the immediately parameter is true, the viewport fits instantly without animation. If false, the viewport fits with animation. ...

Highlighting LaTeX in Monaco Editor

Highlighting LaTeX in Monaco Editor

Overview I had the opportunity to highlight LaTeX in Monaco Editor, so here are my notes. This is a follow-up to the following article that targeted Ace Editor. I hope this serves as a useful reference. Screenshot Demo Site https://nakamura196.github.io/ace_latex/monaco/ Repository https://github.com/nakamura196/ace_latex/ Source Code <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Monaco Editor Demo</title> <link href="https://cdn.jsdelivr.net/npm/monaco-editor@0.40.0/min/vs/editor/editor.main.min.css" rel="stylesheet" /> </head> <body> <h2>Monaco Editor LaTeX</h2> <div id="container" style="width: 100%; height: 600px; border: 1px solid lightgray" ></div> <script src="https://cdn.jsdelivr.net/npm/monaco-editor@0.40.0/min/vs/loader.min.js"></script> <script> require.config({ paths: { vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.40.0/min/vs", }, }); require(["vs/editor/editor.main"], function () { // Register a new language monaco.languages.register({ id: "latex" }); // Register a tokens provider for the language monaco.languages.setMonarchTokensProvider("latex", { tokenizer: { root: [ [/(\\[a-zA-Z]+)/, "command"], // LaTeX commands [/(\\[\w\u3000-\u9FFF]+)/, "note"], // LaTeX commands [/(\{)/, "brace"], [/(\})/, "brace"], [/(\[)/, "bracket"], [/(\])/, "bracket"], [/(document|dvips)/, "keyword"], // LaTeX keywords [/(%.*)/, "comment"], // Comments ], }, }); // Define a new theme that contains only rules that match this language monaco.editor.defineTheme("myTheme", { base: "vs", inherit: true, rules: [ { token: "command", foreground: "#F44336" }, // LaTeX commands in red { token: "note", foreground: "#2196F3" }, // Notes in blue { token: "brace", foreground: "FF00FF" }, // Braces in magenta { token: "bracket", foreground: "00FFFF" }, // Brackets in cyan { token: "keyword", foreground: "#4CAF50" }, // Keywords in green { token: "comment", foreground: "#9E9E9E" }, // Comments in gray ], colors: {}, }); monaco.editor.create(document.getElementById("container"), { value: getCode(), language: "latex", theme: "myTheme", wordWrap: true, }); }); function getCode() { return `\\documentclass{tbook} \\usepackage{hiragino,cid} \\usepackage[dvips]{graphics} \\usepackage{font} % \\見開き \\begin{document} テキスト \\書名{(サンプル)}テキスト 長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト長いテキスト\\右注{(あああ)}長いテキスト長いテキスト \\右注{(サンプル)}テキスト \\end{document}`; } </script> </body> </html> The following page was helpful for configuring custom languages. ...

Highlighting TeX with Ace.js

Highlighting TeX with Ace.js

Overview I had an opportunity to highlight TeX with Ace.js, so here are my notes. I referenced the following article. https://banatech.net/blog/view/11 I hope this serves as a helpful reference. Screen Example Demo Site https://nakamura196.github.io/ace_latex/ Repository https://github.com/nakamura196/ace_latex Source Code <html lang="en"> <head> <title>ACE in Action</title> </head> <body> <div id="editor" style="width: 100%; height: 400px; border: 1px solid gray;"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.23.2/ace.js" integrity="sha512-oVyp48/610D5Jo577cvp2vX+Fc0kYaI6s2tZRqBRzjZh7+y/vOEHTzUefbXk/B8P0B76bOK3tL1zeF/QcXlyiA==" crossorigin="anonymous" referrerpolicy="no-referrer" ></script> <script> const text = `\\usepackage{hiragino,ryumin,cid} \\usepackage[dvips]{graphics} \\usepackage{multicol} \\begin{document} テキスト \\右注{(サンプル)}テキスト \\end{document}`; const editor = ace.edit("editor"); // editor.setTheme("ace/theme/monokai"); editor.setFontSize(14); editor.getSession().setMode("ace/mode/latex"); editor.getSession().setUseWrapMode(true); editor.getSession().setTabSize(4); editor.$blockScrolling = Infinity; editor.setOptions({ enableBasicAutocompletion: true, enableSnippets: true, }); editor.setValue(text, 1); </script> </body> </html>

Building a Django CI/CD Environment from GitHub to EC2 Using GitHub Actions (2023 Edition)

Building a Django CI/CD Environment from GitHub to EC2 Using GitHub Actions (2023 Edition)

Overview I had the opportunity to build a Django CI/CD environment from GitHub to EC2 using GitHub Actions, and here are my notes. The following article was used as a reference. https://qiita.com/fffukken/items/27b0bfa712940914d3f6 I made some updates to the GitHub Actions configuration compared to the above article. GitHub Actions Configuration name: Test and Deploy on: push: branches: [ develop, main ] pull_request: branches: [ develop ] jobs: build: runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: python-version: [3.9, "3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Run Tests run: | python manage.py makemigrations python manage.py migrate python manage.py test - name: deploy run: | echo "$SECRET_KEY" > secret_key chmod 600 secret_key ssh -oStrictHostKeyChecking=no ${EC2_USER}@${EC2_HOST} -i secret_key "source <仮想環境名>/bin/activate \ && cd ~/<プロジェクト名>\ && git pull origin main \ && python manage.py makemigrations \ && python manage.py migrate \ && deactivate \ && sudo systemctl restart gunicorn" env: SECRET_KEY: ${{ secrets.SECRET_KEY }} EC2_USER: ${{ secrets.EC2_USER }} EC2_HOST: ${{ secrets.EC2_HOST }} The changes made were updating the versions of actions/checkout and actions/setup-python. I also changed the pip install section to pip install -r requirements.txt. ...

django-simple-history: Recording Model Edit History in Django

django-simple-history: Recording Model Edit History in Django

Overview This is a personal note from researching how to keep edit history in Django. As shown in the following message, by default, edit history is recorded for changes made through the admin interface, but not for changes made through other interfaces. This object doesn’t have a change history. It probably wasn’t added via this admin site. django-simple-history So I tried using the following package. https://django-simple-history.readthedocs.io/en/latest/ I was able to use it without issues by following the quick start page below. ...

Implementing Partial Match Filters in Django Rest Framework (DRF)

Implementing Partial Match Filters in Django Rest Framework (DRF)

To implement partial match filters in Django Rest Framework (DRF), it is common to use the Django filter backend. This uses the django_filters module. If you haven’t installed this module yet, you can install it with the following command: pip install django-filter Here are the general steps to achieve partial match search: Define a filter set. The following is a filter set for performing partial match search on the name field of a model called MyModel in models.py: ...

How to Bulk Delete Collections in Omeka Classic

How to Bulk Delete Collections in Omeka Classic

Overview This article introduces one approach for bulk deleting collections in Omeka Classic. In Omeka Classic (Version 3.1.1), there is no GUI for selecting and deleting multiple collections at once. However, this functionality is available for items. Therefore, we will use the API to perform bulk deletion of collections. Obtaining the API Key Follow the instructions below to enable the API and generate an API key: https://omeka.org/classic/docs/Admin/Settings/API_Settings/ Specifically, first access the following page: ...