Leverage AI for building a prototype of a VUI / GUI for logging home gardening activities: planting, mulching, watering, weeding, harvesting, etc
- Spring Boot with Spring AI, leveraging OpenAI's chat completions API
The book provides this first implementation, which as written traverses each element past i
two times per recursion:
def qsort(arr):
if len(arr) < 2:
return arr
pivot = arr[0]
less = [i for i in arr[1:] if i <= pivot]
# NOTE: this traverses all N elements twice in the list.
greater = [i for i in arr[1:] if i > pivot]
When storing events to track the complete path of state transitions for an aggregate, it is always possible to also store a projection of the current state, but this is usually only necessary for aggregates that have large numbers of events. Since each SCA Transaction will not have a large number of events, that is probably overkill. Instead, a simple process of reading the list of past events and flowing them through a function that is capable of producing, or projecting, a model is rather straight forward. The most important part is to design this such that it only operates on the events, not on the original requests of "commands" since these often have side-effects like calling APIs, saving data, etc.
In Kotlin, this is easily achieved with a left fold
over the set of events. For illustration purposes, consider the following simple illustration. You can run and edit the sample online here in the Kotlin Playground.
class Statef
./MiniCapPortable/MiniCap.exe -save C:\\Users\\Josh\\cap.jpg -captureactivewin -exit | |
certutil -encode cap.jpg cap.txt | |
(lines=$(wc -l < cap.txt); tail -n +2 cap.txt | head -n $(($lines-2)) | tr -d '\n') | awk '{ print "data:image/jpg;charset=utf-8;base64,"$1 }' >data.url |
Inspired by:
https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api/ https://stackoverflow.com/questions/13872273/api-pagination-best-practices
The following command returns everything available, 47 results in this case:
Note: there's a default page size of 1000, which is why the next and prev have the same values in this case, though we might just strip the parameters out when everything is visible
Demonstrates how to use a single command to assign multiple Members to a Scope along with Scope-specific roles each Member will have for the target Scope.
For the context of this example, the following request will setup the instance with the needed starting conditions:
The following input payload specifies an array with 9 commands. These nine commands expand to 13 concrete actions for the backend API processor to execute. However, 12 of these actions are erroneous! Only one of them will succeed against the database running on the instance.
[
{
"from": "Animal"
},
{
"from": "Scope",
"where": {
$(document).arrive('.story-card', function() { | |
const story = $(this); | |
const applyStatusAging = () => { | |
const number = story.find('.number').text().trim(); | |
const title = story.find('.title'); | |
const query = ` | |
from: PrimaryWorkitem | |
where: | |
Number: ${number} |