Create a programming-langague-independent API for a modern headless archival digital repository for an academic research library. Start with an overall list of the major functions that need to be supported text that explains what the general functionality area covers, then list individual endpoints under each heading along with possible arguments and error conditions that would need to provide feedbasck via the return values.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //----------- STRINGS --------------- | |
| fun string_stuff() { | |
| // fstring / text blocks | |
| val name = "Alice" | |
| val age = 30 | |
| val message = "Hello, $name, you are $age. In ten years you'll be ${age + 10}." | |
| val longer = """ | |
| This is a much longer string. It can also do interpolation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "benchmark/ips" | |
| require "marc" | |
| require "../lib/marc/jsonl_reader" | |
| require "zinzout" | |
| source_file = "/Users/dueberb/devel/mlibrary/data/search_full_bibs/all.jsonl.gz" | |
| temp_file = "/tmp/500k.bat" | |
| require "pathname" | |
Summarize the algorithm described between START and STOP
START
This is the process:
-
Take the first 12 digits of the 13-digit ISBN
-
Multiply each number in turn, from left to right by a number. The first digit is multiplied by 1, the second by 3, the third by 1 again, the fourth by 3 again, and so on to the eleventh which is multiplied by 1 and the twelfth by 3.
-
Add all of the 12 answers.
This is a very simple, self-contained (well, except for benchmark-ips) benchmark. Conceptually, it does the following:
- Create an array-of-arrays, each element being a 20-element array of integers
- Write it out to a file as JSON
- Write it out to a gzipped file as JSON
- Read them both back in as strings
- Compare how long it takes to JSON.parse the never-gzipped (plain) string vs the previously-gzipped string
Usage via slow_gzip_bench.rb -h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # frozen_string_literal: true | |
| # # Simple example -- get ids and titles of all items without an author | |
| # | |
| # rsolr = RSolr.connect(url: 'http://localhost:8025/solr/catalog') | |
| # stream = rsolr.streamer(handler: 'select') do |s| | |
| # s.filter = 'NOT author:[* TO *]' | |
| # s.sort = 'id asc' | |
| # s.fields = ['id', 'title'] | |
| # s.batch_size = 2_000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <collection> | |
| <record> | |
| <leader>00000nas a2200000 i 4500</leader> | |
| <controlfield tag="001">990155606890206381</controlfield> | |
| <controlfield tag="005">20190626105359.0</controlfield> | |
| <controlfield tag="008">170919c20179999miuuu p 6 0 a0eng d</controlfield> | |
| <datafield tag="035" ind1=" " ind2=" "> | |
| <subfield code="a">(MiU)015560689MIU01</subfield> | |
| </datafield> |
A basic run through of how things move through SLIP.
- slip_rights: (one row per item). A copy-ish of rights_current with additional information about when an item was last updated. Populated/updated from vufind solr.
- slip_queue: (one row per item-to-update). A list of HTIDs along with slots to hold information about which (if any) process is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| truffleruby 22.3.0, like ruby 3.0.3, GraalVM CE Native [x86_64-darwin] | |
| Base unit is an array of 20 integers | |
| JSON-decode a string encoding an array of 10 of those base units. | |
| Calculating ------------------------------------- | |
| JSON 10 plain 6.817k (±14.0%) i/s - 133.364k in 19.995768s | |
| JSON 10 gzdata 1.204k (±28.0%) i/s - 15.611k in 20.047997s | |
| JSON 10 flattened 6.954k (± 9.6%) i/s - 138.006k in 20.090469s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BasicObject | |
| # kwargs always goes in as at least an empty hash, so need to | |
| # special-case it for methods/functions without keyword args | |
| def safe_call(*args, **kwargs) | |
| kwargs.empty? ? self.call(*args) : self.call(*args, **kwargs) | |
| end | |
| # Call the provided callable (or symbol for a method on the current object) | |
| # with the caller as the first argument along with whatever else | |
| # was passed in as subsequent arguments |
NewerOlder