Trying the Drupal Social Auth GitHub Module

Overview I will try the Drupal Social Auth GitHub module. https://www.drupal.org/project/social_auth_github/ This module is described as follows: Social Auth GitHub allows users to register and login to your Drupal site with their GitHub account. The goal is to enable login using a GitHub account as shown below. Installation composer.phar require 'drupal/social_auth_github:^4.0' vendor/bin/drush en social_auth_github The above installation also enables social_auth and social_api. Configuration Follow the configuration instructions on the following page. ...

January 2, 2024 · 2 min · Nakamura

Testing Drupal REST Resource Cookie Authentication Using Postman

Overview In the following article, I tried JWT authentication using the JWT module. This time, I will try cookie authentication. Installation If the restui module is not installed, install and enable it with a command like the following. composer.phar require 'drupal/restui:^1.21' vendor/bin/drush en restui Configuration This time, I will use cookie authentication as shown below. For details on the configuration method, please refer to the related article at the beginning. ...

January 1, 2024 · 2 min · Nakamura

Trying the Drupal JSON Web Token Authentication Module

Overview I will try the Drupal JSON Web Token Authentication module. https://www.drupal.org/project/jwt I referenced the following page. https://preston.so/writing/decoupled-drupal-authentication-with-json-web-tokens/ Note that the following is a similar module. https://www.drupal.org/project/rest_api_authentication JWT authentication using the above module is described here. https://www.drupal.org/docs/contributed-modules/api-authentication/jwt-authentication However, as described in the following article, it appears that using JWT authentication with the above module requires a paid plan. Therefore, this time I will try the jwt module instead. Installation and Activation jwt module ...

December 31, 2023 · 4 min · Nakamura

Investigation of the Drupal REST & JSON API Authentication Module

Overview I will try JWT authentication, referencing the following article. https://www.drupal.org/docs/contributed-modules/api-authentication/jwt-authentication However, after trying it, it appeared that a paid plan subscription was required to use JWT authentication, and the investigation stopped there. Prerequisite: Download and Installation Install and enable the following two modules. https://www.drupal.org/project/rest_api_authentication https://www.drupal.org/project/restui composer.phar require 'drupal/rest_api_authentication:^2.0' composer.phar require 'drupal/restui:^1.21' vendor/bin/drush en rest_api_authentication Steps to Configure JWT-Based API Authentication Follow the instructions below to enable the API and set up JWT-based API authentication. ...

December 31, 2023 · 1 min · Nakamura

Updating Drupal on Sakura Rental Server

Overview This is a note on the procedure for updating Drupal on Sakura rental server. First, we referred to the following site. https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-drush However, it contained the following note: Use Composer to manage Drupal dependencies. Drush 9 and newer no longer supports updating Drupal. We also referred to the following: https://drupalfan.com/drupal10を最新版にアップデートする/ Procedure ! This may contain incorrect or unnecessary steps. Please use it as a reference only. Navigate to the directory where Drupal was downloaded. ...

December 22, 2023 · 2 min · Nakamura

Drupal Module Development: Searching with Variant Characters in Mind

Overview While developing a system using Drupal, I needed to implement search functionality that considers variant characters (itaiji), so I created a custom module to achieve this. (There may already be an existing module that does the same thing, but I was unable to find one.) It is published in the following repository: https://github.com/nakamura196/Drupal-module-itaiji Usage Configuration Access /admin/config and click the Itaiji link under the Search and metadata section. ...

December 21, 2023 · 1 min · Nakamura

Troubleshooting Errors When Running lando start

While developing Drupal and Omeka modules using Lando, a local development environment tool, the following error occasionally occurred. lando start __ __ __ __ ___ _ __ __ __ ______ / / / /__ ___/ /__ _/ /____ / _ |_ _____ _(_) /__ _/ / / /__ / / / / / /_/ / _ \/ _ / _ `/ __/ -_) / __ | |/ / _ `/ / / _ `/ _ \/ / -_)_/_/_/ \____/ .__/\_,_/\_,_/\__/\__/ /_/ |_|___/\_,_/_/_/\_,_/_.__/_/\__(_|_|_) /_/ Updating helps us provide the best support and saves us tons of time Use the link below to get the latest and greatest https://github.com/lando/lando/releases/tag/v3.20.8 Lando is FREE and OPEN SOURCE software that relies on contributions from developers like you! If you like Lando then help us spend more time making, updating and supporting it by contributing at the link below https://github.com/sponsors/lando If you would like to customize the behavior of this message then check out: https://docs.lando.dev/config/releases.html Let's get this party started! Starting app my-lando-app... ERROR ==> connect ENOENT /var/run/docker.sock ██╗ ██╗██╗ ██╗ ██████╗ ██╗ ██╗██╗ ██║ ██║██║ ██║ ██╔═══██╗██║ ██║██║ ██║ ██║███████║ ██║ ██║███████║██║ ██║ ██║██╔══██║ ██║ ██║██╔══██║╚═╝ ╚██████╔╝██║ ██║ ╚██████╔╝██║ ██║██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ An error occurred while starting up your app! Here are a few things you can try to get back into a good state: ■ Try running lando rebuild ■ Try restarting in debug mode lando restart -vvv ■ Try checking the logs with lando logs If those fail then consult the troubleshooting materials: ■ https://docs.lando.dev/help/logs.html ■ https://docs.lando.dev/help/updating.html Or post your issue to Slack or GitHub ■ Slack - https://launchpass.com/devwithlando ■ GitHub - https://github.com/lando/lando/issues/new/choose ERROR ==> connect ENOENT /var/run/docker.sock This issue was mentioned in the following GitHub issue. ...

December 21, 2023 · 2 min · Nakamura

Drush Command Cheat Sheet

Overview These are notes on frequently used commands during Drupal module development. Clearing Cache drush cr Importing Translation Files The following is an example of importing a Japanese language file for a module called itaiji. drush locale:import ja /app/web/modules/custom/Drupal-module-itaiji/translations/itaiji.ja.po Reinstalling a Module drush pm-uninstall itaiji && drush en itaiji

December 20, 2023 · 1 min · Nakamura

Pagination Error When Using JSON:API Search API in Drupal

When using the JSON:API Search API in Drupal, an error occurred when adding query parameters such as page[limit]. https://www.drupal.org/project/jsonapi_search_api Specifically, the following error message was displayed. Input value “page” contains a non-scalar value. Upon investigation, this was also mentioned in the following issue. https://www.drupal.org/project/jsonapi_search_api/issues/3403107 Since it was fixed in the development version 8.x-1.x-dev, I replaced it with the following. https://www.drupal.org/project/jsonapi_search_api/releases/8.x-1.x-dev As a result, the error was resolved. Whether to use the development version of the module requires consideration, but I hope this is helpful for those experiencing the same issue. ...

December 16, 2023 · 1 min · Nakamura

Usage Example of the Image Map Editor in Oxygen XML Editor

Overview This is an explanation of how to use the Image Map Editor in Oxygen XML Editor. Video https://youtu.be/9dZQ1v0Rky0?si=8EhAZdVsLqgPz2Rf Usage Prepare a TEI/XML file like the following. The url value of <graphic> can specify a relative path from the file, an absolute path on your PC, or a URL published on the internet. In the following example, the file digidepo_3437686_pn_null_9c48d89b-e2ec-4593-8d00-6fbc1d29d1bd.jpg stored in the same folder as the TEI/XML file is referenced. ...

December 12, 2023 · 1 min · Nakamura

Georeferencing with Allmaps

Overview This time, we try georeferencing using Allmaps. https://allmaps.org/ Allmaps is described as follows. Allmaps makes it easier and more inspiring to curate, georeference and explore collections of digitized maps. This time, we use the “Bird’s-eye View of the University of Tokyo Main Campus and Faculty of Agriculture Buildings” held by the University of Tokyo Library for Agriculture and Life Sciences. https://da.dl.itc.u-tokyo.ac.jp/portal/assets/187cc82d-11e6-9912-9dd4-b4cca9b10970 We create the following result. https://viewer.allmaps.org/?url=https%3A%2F%2Fannotations.allmaps.org%2Fimages%2F2e1d3f991aad6cb4 ...

December 7, 2023 · 4 min · Nakamura

Nuxt3 x Vuetify x Cesium

Overview I created a sample repository using Nuxt3, Vuetify, and Cesium. Source Code vue-cesium is used. https://github.com/zouyaoji/vue-cesium The GitHub repository is as follows. https://github.com/nakamura196/nuxt3-vuetify-cesium Demo Site https://nakamura196.github.io/nuxt3-vuetify-cesium/ Summary We hope this serves as a useful reference.

November 30, 2023 · 1 min · Nakamura

Trying Nuxt 3 and Decap CMS

Overview I tried out Nuxt 3 and Decap CMS, so here are my notes. https://decapcms.org/ Preparing the Nuxt 3 Project I referred to the following for adding Decap CMS to an existing site. https://decapcms.org/docs/add-to-your-site/ First, prepare a Nuxt 3 project that includes the nuxt/content module. Here is an example of the source code. https://github.com/nakamura196/nuxt3-decapcms The following two files were created. # when using the default proxy server port local_backend: true # This line should *not* be indented publish_mode: editorial_workflow backend: name: git-gateway branch: main # Branch to update (optional; defaults to master) media_folder: public/img public_folder: /img collections: - name: 'blog' label: 'Blog' folder: 'content/blog' format: 'frontmatter' create: true slug: '{{year}}-{{month}}-{{day}}-{{slug}}' fields: - { label: 'Title', name: 'title', widget: 'string' } - { label: 'Publish Date', name: 'date', widget: 'datetime' } - { label: 'Description', name: 'description', widget: 'string' } - { label: 'Body', name: 'body', widget: 'markdown' } <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Content Manager</title> <!-- Include the script that enables Netlify Identity on this page. --> <script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script> </head> <body> <!-- Include the script that builds the page and powers Decap CMS --> <script src="https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js"></script> </body> </html> Then, it was pushed to GitHub. ...

November 30, 2023 · 2 min · Nakamura

Handling AttributeError: 'ImageDraw' object has no attribute 'textsize'

When using the following in Python’s Pillow: textsize = 14 font = ImageFont.truetype("Arial Unicode.ttf", size=textsize) txw, txh = draw.textlength(label, font=font) The following error occurred. AttributeError: ‘ImageDraw’ object has no attribute ’textsize’ The following was helpful as a solution. https://stackoverflow.com/questions/77038132/python-pillow-pil-doesnt-recognize-the-attribute-textsize-of-the-object-imag Specifically, I rewrote it as follows. textsize = 14 font = ImageFont.truetype("Arial Unicode.ttf", size=textsize) txw = draw.textlength(label, font=font) txh = textsize I hope this is helpful.

November 26, 2023 · 1 min · Nakamura

Restarting Virtuoso on EC2 Using Amazon SNS

Overview In the following article, I described how to perform health checks. I also described the command for restarting Virtuoso when it stops in the following article. This time, I will try restarting Virtuoso in conjunction with Amazon SNS notifications. Method To send a command like sudo rm -rf /usr/local/var/lib/virtuoso/db/virtuoso.lck && ... to an EC2 instance, SSM (AWS Systems Manager) configuration was required. IAM Roles and Policies I created a new IAM role and granted the AmazonSSMFullAccess policy. Initially, I had granted the AmazonSSMManagedInstanceCore policy, but the following error occurred when executing the Lambda function described later, and it did not work properly. ...

November 24, 2023 · 3 min · Nakamura

Resolving SAM Error: Running AWS SAM Projects Locally Requires Docker

Overview When trying sam local invoke with AWS SAM, the following message was displayed. Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running? The environment was Mac, and Docker was running. Solution Running the following command resolved the issue. sudo ln -s ~/.docker/run/docker.sock /var/run/docker.sock I referenced the following. https://github.com/lando/lando/issues/3533 Summary I hope this is helpful for anyone facing the same issue.

November 24, 2023 · 1 min · Nakamura

Trying Leaflet Marker Cluster with Nuxt 3 and Composition API

Overview In the following article, I introduced how to use Leaflet Marker Cluster with Nuxt 3. This time, I updated it to use the Composition API, so here are my notes. Installation Install the following: npm i leaflet leaflet.markercluster @vue-leaflet/vue-leaflet npm i -D @types/leaflet @types/leaflet.markercluster Source Code Please refer to the following: https://github.com/nakamura196/nuxt3-demo/blob/main/components/map/MarkerCluster.vue Summary There are some parts where TypeScript support is incomplete, but I hope this serves as a useful reference. ...

November 24, 2023 · 1 min · Nakamura

Example of Creating a Page Using Universal Viewer v4

Overview I created a page where Universal Viewer is displayed across the entire page, as shown below, so this is a memo of the process. Universal Viewer v4 is used. https://nuxt3-demo-nine.vercel.app/uv/?manifest=https://dl.ndl.go.jp/api/iiif/3437686/manifest.json Source Code Please refer to the following source code. https://github.com/nakamura196/nuxt3-demo/blob/main/public/uv/index.html Referring to the following page: https://github.com/UniversalViewer/universalviewer/wiki/UV-Examples and the following sample, the viewer size is adjusted to change according to page resizing. https://codesandbox.io/s/uv-url-adapter-example-9d6x8 It also includes code to receive a manifest query parameter. ...

November 24, 2023 · 1 min · Nakamura

Nuxt3 x Vuetify x Cytoscape

Overview I added a Cytoscape demo to a sample repository using Nuxt3 and Vuetify. https://github.com/nakamura196/nuxt3-demo You can check it working on the following page. https://nakamura196.github.io/nuxt3-demo/ Installation I ran the following. npm i cytoscape npm i @types/cytoscape Source Code <template> <div id="view"> <v-btn class="ma-4" color="primary" v-on:click="addNode">push</v-btn> <div id="cy"></div> </div> </template> <script setup lang="ts"> import cytoscape from "cytoscape"; let cy: any = null; // = ref(null); //reactive({}); //: any const count: number = 0; // = ref(0); //reactive(0); const addNode = () => { cy.add([ { group: "nodes", data: { id: "node" + count }, position: { x: 300, y: 200 }, }, { group: "edges", data: { id: "edge" + count, source: "node" + count, target: "cat" }, }, ]); }; onMounted(() => { cy = cytoscape({ container: document.getElementById("cy"), boxSelectionEnabled: false, autounselectify: true, style: cytoscape .stylesheet() .selector("node") .css({ height: 80, width: 80, "background-fit": "cover", "border-color": "#000", "border-width": 3, "border-opacity": 0.5, content: "data(name)", "text-valign": "center", }) .selector("edge") .css({ width: 6, "target-arrow-shape": "triangle", "line-color": "#ffaaaa", "target-arrow-color": "#ffaaaa", "curve-style": "bezier", }), elements: { nodes: [ { data: { id: "cat" } }, { data: { id: "bird" } }, { data: { id: "ladybug" } }, { data: { id: "aphid" } }, { data: { id: "rose" } }, { data: { id: "grasshopper" } }, { data: { id: "plant" } }, { data: { id: "wheat" } }, ], edges: [ { data: { source: "cat", target: "bird" } }, { data: { source: "bird", target: "ladybug" } }, { data: { source: "bird", target: "grasshopper" } }, { data: { source: "grasshopper", target: "plant" } }, { data: { source: "grasshopper", target: "wheat" } }, { data: { source: "ladybug", target: "aphid" } }, { data: { source: "aphid", target: "rose" } }, ], }, layout: { name: "breadthfirst", directed: true, padding: 10, }, }); }); </script> <style scoped> #cy { width: 100%; height: 80%; position: absolute; background-color: lightcyan; } </style> Summary I hope this is helpful. ...

November 18, 2023 · 2 min · Nakamura

Cantaloupe: Running as a Service

Overview The Cantaloupe Image Server can be run with the following command. java -Dcantaloupe.config=cantaloupe.properties -Xmx2g -jar cantaloupe-5.0.5.jar However, with this method, the Cantaloupe server stops when the SSH connection is lost, for example. Here I introduce how to run it as a service. Method Create a service file: Create a service file (e.g., cantaloupe.service) in the /etc/systemd/system/ directory with sudo privileges. [Unit] Description=Cantaloupe Image Server [Service] User=ubuntu # Please modify the following paths as appropriate WorkingDirectory=/home/ubuntu/cantaloupe-5.0.5 ExecStart=/usr/bin/java -Dcantaloupe.config=cantaloupe.properties -Xmx2g -jar cantaloupe-5.0.5.jar SuccessExitStatus=143 [Install] WantedBy=multi-user.target In this file, the Java command to execute is specified in ExecStart. Also, User and WorkingDirectory need to be set appropriately. ...

November 16, 2023 · 2 min · Nakamura