Skip to content

Instantly share code, notes, and snippets.

View joewiz's full-sized avatar

Joe Wicentowski joewiz

  • Arlington, Virginia
View GitHub Profile
@joewiz
joewiz / 01-library.xql
Last active March 13, 2026 06:56
Unit testing XQuery with XQSuite in eXist-db: tests for a sample function, how to run tests, and test results
xquery version "3.0";
(: This sample library module contains a single function, iu:analyze-date-string().
: The purpose of the sample is to demonstrate XQSuite tests, a unit test framework that uses
: XQuery 3.0's Annotations facility to embed testing assertions and parameters in XQuery functions.
:
: By writing unit tests and running them after each new change to an application, we can spot new bugs
: right away and prevent regressions.
:
: The XQSuite tests in this example are stored in a separate module, 02-tests-xql.
@joewiz
joewiz / claude-code-semver.xq-session-5-log.txt
Created February 26, 2026 12:52
claude-code-semver.xq-session-5-log.txt
╭─── Claude Code v2.1.59 ───────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Joe! │ Run /init to create a CLAUDE.md file… │
│ │ ───────────────────────────────────── │
│ │ Recent activity │
│ ▗ ▗ ▖ ▖ │ No recent activity │
│ │ │
│ ▘▘ ▝▝ │ │
│ Sonnet 4.6 · Claude Pro · Joe Wicentowski │ │
@joewiz
joewiz / claude-code-semver.xq-session-4-log.txt
Last active February 23, 2026 17:38
claude-code-semver.xq-session-4-log.txt
╭─── Claude Code v2.1.50 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Joe! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ │ No recent activity │
│ ✻ │
@joewiz
joewiz / claude-code-semver.xq-session-3-log.txt
Last active February 22, 2026 15:55
claude-code-semver.xq-session-3-log
╭─── Claude Code v2.1.50 ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back Joe! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────── │
│ │ Recent activity │
│ │ No recent activity │
│ ✻ │
@joewiz
joewiz / claude-code-semver.xq-session-2-reflections.md
Last active February 22, 2026 15:11
Claude Code semver.xq session 2: Reflections

❯ I plan to repeat this on some other repositories. Do you have any lessons you'd like me to pass on to Claude for the next session, to help proceed more directly toward the solution we adopted?

Key technical facts (things that would have saved the most time if known upfront):

  1. HTTPS on port 8443, not HTTP on 8080 — @existdb/gulp-exist v5 defaults to secure: true; node-exist's compat shim converts that to protocol, overriding any HTTP setting from env vars. Don't fight it — use HTTPS and map port 8443 in CI, matching roaster's approach. Set rejectUnauthorized: false in the test runner for the self-signed cert.
  2. expath-pkg.xml path — Use semver.xqm, not content/semver.xqm. eXist-db's EXPath resolver prepends content/ automatically; doubling it breaks eXist-db 5.0.0 (6.x is forgiving). eXist-db-specific metadata (<author>, <website>, <status>, etc.) belongs only in repo.xml, not expath-pkg.xml.
  3. XQSuite test runner — Use inspect:module-functions(xs:anyURI("xm
@joewiz
joewiz / claude-code-semver.xq-session.txt
Created February 20, 2026 16:36
Claude Code semver.xq session
❯ Take a look around this repository and let me know if you have any suggestions for bug fixes or improvements.
⏺ Explore(Explore repository structure)
⎿  Done (15 tool uses · 56.7k tokens · 45s)
(ctrl+o to expand)
⏺ Let me verify the most notable finding - the potential bug in semver:eq().
⏺ Read 1 file (ctrl+o to expand)
@joewiz
joewiz / migrating-from-old-to-new-indexes.md
Last active June 13, 2025 18:22
Converting an eXist application from old-style fields to new, Lucene-based facets and fields

Converting an eXist application from old-style fields to new, Lucene-based facets and fields

This article walks through the process of migrating an eXist application from using old-style fields to using the new, Lucene-based facets and fields. For more information, see the eXist documentation's Lucene article.

Old-style approach

In the old-style approach to fields, fields were constructed and maintained manually via the ft:index() function. To add or update fields for a document, a <doc> element containing <field> elements was passed to this function, along with the URI of the resource to be indexed.

For example, in one application, fields were constructed with in the hsa/modules/index.xq library module, whose index:index-one-document() function constructed the <field> elements and passed them to the ft:index() function:

@joewiz
joewiz / web-scraping-with-xquery.md
Last active December 8, 2024 13:05
Web Scraping with XQuery

Web Scraping with XQuery

Overview

Learning how to web scrape empowers you to apply your XQuery skills to any data residing on the web. You can fetch data from remote sites and services—for example, entire web pages or just the pieces of a page that matter to you. Once fetched, you can perform further analysis on the data, clean it up, mash it up with other data, transform it into different formats, etc.

Built-in functions for making HTTP requests

XPath-based languages like XQuery offer an standard function for accessing remote documents, the fn:doc() function. However, a limitation of this function is that it only works if the URI returns a well-formed XML document.

@joewiz
joewiz / post-mortem.md
Last active October 16, 2024 07:39
Recovery from nginx "Too many open files" error on Amazon AWS Linux

On Tue Oct 27, 2015, history.state.gov began buckling under load, intermittently issuing 500 errors. Nginx's error log was sprinkled with the following errors:

2015/10/27 21:48:36 [crit] 2475#0: accept4() failed (24: Too many open files)

2015/10/27 21:48:36 [alert] 2475#0: *7163915 socket() failed (24: Too many open files) while connecting to upstream...

An article at http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ provided directions that mostly worked. Below are the steps we followed. The steps that diverged from the article's directions are marked with an *.

  1. * Instead of using su to run ulimit on the nginx account, use ps aux | grep nginx to locate nginx's process IDs. Then query each process's file handle limits using cat /proc/pid/limits (where pid is the process id retrieved from ps). (Note: sudo may be necessary on your system for the cat command here, depending on your system.)
  2. Added fs.file-max = 70000 to /etc/sysctl.conf
@joewiz
joewiz / maps-to-csv.xq
Last active February 5, 2024 14:35
Convert XQuery maps to CSV (or TSV)
xquery version "3.1";
(: Convert a sequence of XQuery maps into CSV or TSV.
: Each map becomes one row.
: The entries' keys become column headers.
:)
declare variable $local:default-options :=
map {
(: Character to separate cells with :)