2022-12-03

🔗
  • I renamed Prefect to Effectum today, since it turns out that there's always a rapidly growing startup in a similar space named Prefect.

2022-12-02

🔗
  • Added conditional format conversions to Pic Store today. This lets you configure it to do things like generate PNGs only if the input was also a PNG, so that you don't do silly things like output a PNG of a photo. Next up will be the Pic Store integration mentioned in the previous post.
  • I also finally wrote a short README for my LetsEncrypt SSL renewer utility.
  • Learning
    • Last night I watched Join Order Optimization with (almost) no Statistics by Tom Ebergen. In this video, Tom describes enhancements he made to the join planner in DuckDB, and how it applies both to native tables where you have some extra metadata about the contents of each column, and on external files such as Parquet or CSV, where you don't know much about the actual contents. Good watching if you have any interest in database systems.

2022-11-28

🔗
  • Added support today for writing JPEGs and reading HEIC files. The HEIC input will need a bit of tweaking but it’s mostly there.
  • Once the Pic Store MVP is wrapped up I’m going to add support for it to my Logseq exporter, and then maybe implement the server mode for Effectum.
  • As for the public project roadmap, I think Linear is the way to go there. Should be easy enough to pull down the issues from their API and add some pages here to display them.

2022-11-27

🔗
  • Thinking about how to better represent the progress and plans for my various projects. I moved a lot of my internal TODO lists over to Github issues, which works all right, and I can even create a view that shows issues from multiple repositories at once. This is especially nice now that I'm building up a small eco system of projects, some of which are using others as dependencies.
  • I also tried Linear briefly and while I love the interface, there doesn't seem to be any way to "build in public" with it. So I'm torn about that. Maybe I'll make a small program to export issues from the API and write out some Markdown with the project status, which I can then publish here.

2022-11-25

🔗
  • Implemented job recovery in Effectum today, so that if the process restarts unexpectedly the jobs can be retried. I also did a bit of cleanup to prepare for the eventual addition of a server mode. The aim is to allow switching from an embedded task queue to one hosted on a server, and not have to significantly change the API, so that you can keep complexity down at first but then scale up with minimal fuss when necessary.
  • Pic Store is now running on Axum 0.6, which was just released. For the feature set I was using, it was a pretty seamless change. I like that there's a lot more clarity now between extractors that consume the request body (e.g. Json parsing) and those that don't touch it at all.

2022-11-24

🔗
  • Added "lookup by hash" to Pic Store today. This allows the client to determine if an image already exists in the store, without knowing the ID in advance.

2022-11-23

🔗
  • Didn't have time to mention it here last night but the Let's Encrypt DNS challenge tool is all working. It starts the challenge, adds the required DNS entry to Vercel, and then uploads the resulting certificate to DigitalOcean and enables it.
  • It's a bit over-engineered — I mean, a shell script run every 60 days would probably have been sufficient — but this will make it easier to add support for more hosts and services types in the future for other projects.
  • I spent an hour trying to figure out why Let's Encrypt was rejecting my DNS record, and in the end turned out to be just a typo in my DNS record (_acme_challenge instead of _acme-challenge). But overall the process wasn't too bad.
  • I'll get around to a full writeup in the near future, I hope, but in the meantime here's the Github repo.
  • Learning
    • In getting S3 upload for Pic Store to work, I found that DigitalOcean Spaces defaults all files to private, with no way to change the default from the web UI. But you can use s3cmd to do it by setting the S3 bucket policy. First, create a policy JSON file:
    • {
          "Version": "2008-10-17",
          "Statement": [
              {
              "Sid": "AddPerm",
              "Effect": "Allow",
              "Principal": "*",
              "Action": "s3:GetObject",
              "Resource": "arn:aws:s3::YOUR_BUCKET_NAME/*"
              }
          ]
      }
      
      
    • Then you can apply it to the bucket like so:
    • s3cmd --access_key=$ACCESS_KEY --secret_key=$SECRET_KEY \
          --host=$REGION.digitaloceanspaces.com \
          --host-bucket=$BUCKET.$REGION.digitaloceanspaces.com \
          --region $REGION \
          setpolicy policy.json s3://$BUCKET \
          --acl-public
      
    • It's a bit quirky, as the DO web interface still shows the files as private, but they are actually public, and this public status also applies to files uploaded in the future.
    • But all that done with, the good news is that Pic Store is now uploading files to cloud storage. Many thanks to Hugo for figuring out this policy file solution and writing about it!

2022-11-21

🔗
  • Pic Store image uploading is all working now, but I ran into issues with actually setting up a CDN to back it. I initially wanted to use Backblaze B2 as the object store, which is set up to work with Cloudflare CDN. But Cloudflare want you to switch your whole domain over to them for it to work, and I don't want to switch my whole DNS setup over since I'm using Vercel.
  • DigitalOcean also prefers that you switch your nameservers to them, but they do offer an alternative option, if you supply your own SSL certificate.
  • So today's free time will be spent building a small utility that talks to LetsEncrypt, Vercel DNS, and DigitalOcean CDN to handle generating the certificate and installing it. There are a few Rust crates that handle the ACME protocol already, so hopefully it should be quick project. I'll write up a small article once it's done.

2022-11-17

🔗
  • Logseq's latest release no longer uses its pages-metadata.edn file, which my note exporter was using to track the created and updated dates of each exported page. Since this file is no longer updated, I updated the program to track them in a SQLite database.
  • For each page, I calculate a hash, and if the page's hash has changed, it updates the database with the file's last modified time. Nice and easy. For older pages, it can still import the initial data from pages-metadata.edn too. Integrating SQLite into the exporter program was a pretty smooth experience; I'm hoping to use it more often.
  • Of course, now that I have all the pages in a database, I can add other data, and that brings up more fun questions about what else I can do with it.
  • Learning
    • I set up Let's Encrypt at work today. Our nginx configuration is somewhat complex and we also run it inside a Docker container, so the process was a bit unusual. I wrote about it here.

2022-11-16

🔗
  • Copilot works well for writing repetitive CRUD endpoints in Pic Store, but better is to not have to write them at all. I've been experimenting with using macros to abstract out the details of CRUD operations. This includes the relevant permissions checks, filtering on team/project, and so on.
  • Seems to be working well so far, and it removes a lot of the boilerplate. I may take this a step further and generate the entire endpoint function with a macro, but I haven't decided yet.
  • Learning

2022-11-14

🔗
  • Got the Pic Store bootstrap command working today. The Postgres ability to defer constraints checking until the end of a transaction is very handy here, when you're loading a bunch of JSON files and don't want to have to sort them topologically according to the foreign arrangement of the tables.
  • I've also been getting a steady stream of Github notification emails for the past hour, all from the same PR at work that someone else is working on. I had an idea a while back to make an Email Digest Service and this is pushing me closer to doing just that. At least Pic Store is getting close enough to MVP that I can push through and start using it soon.
  • Learning
    • AWS Route53 lets you create "alias" records that work like a CNAME, but just redirect to another AWS resource (including other Route53 entries). This incurs less cost than a normal CNAME, since resolving the alias doesn't count as an extra lookup.

2022-11-12

🔗
  • Today I wrote image reading and writing tests for  Pic Store. I came across a number of issues reading AVIF files, which eventually were fixed by switching directly to the  libavif  crate which seems to do a better job parsing certain AVIF files that aren't quite up to spec.
  • I also made a fork of the `imageinfo` crate to help with detecting these files, but I need to go back and see if my fix is really correct before I submit it upstream.

2022-11-11

🔗
  • Started up development on  Pic Store  again. I switched out the task queue to  Effectum  and I got it to the point where the server starts, creates the database, and a simple authenticated request succeeds. A lot of the core code for the project is already implemented, so there will be some testing to see if stuff actually works and then I can start working on a simple web interface, and tools to make it convenient to use.
  • I'm thinking of a Vite plugin that will automatically upload the images if needed and generate a full  <picture>  tag. Also some CLI/GUI utilities that can make it convenient to upload and reference images from other contexts, such as when writing a document.
  • If it's possible, I would love to be able to drag an image straight into Logseq, and have that handle the upload and URL pasting. Will have to see if the plugin system allows intercepting events like that.
  • I've also been rethinking  Ergo a bit. While I previously had done a lot of work on the Javascript task model and got it pretty much working, the development experience still paled compared to any real development environment. I achieved a fair amount there, but I think I'm going to rip out a lot of that support, and focus instead on the "hosted state machine" model that I had originally envisioned.
  • Since I already have a working JS engine in the project, the state machines will continue to support bits of JS to assist in evaluating conditions and such. Tasks with heavier scripting will be runnable as actions that spawn external processes, and can then return values that can trigger further actions in the state machines.
  • From there, I can create other types of tasks that are basically wrappers around certain types of state machines, and hopefully come up with something that's both intuitive to use and actually useful.

2022-11-10

🔗
  • Learning
    • Use with care, but git clean -f will delete all untracked files from a repository.

2022-11-08

🔗
  • The initial release of Effectum is out! Pretty happy with how it turned out, and my first application will be to use it for background image processing in Pic Store. Look for more about that in the coming weeks.
  • One interesting issue I immediately encountered after releasing v0.1.0 was that the trait bounds on the job runner were overly strict. I had required Sync on the future returned by the job runner function, when actually nothing in the library required that. But that meant that any job runner function could not hold a non-Sync value across an await point. Fortunately this was just a matter of removing the trait bound and adding a test whose job runner function holds a Cell across an await.

2022-11-04

🔗
  • When it comes time to actually document code for public consumption, Rust's missing_docs lint is great. I don't have to search out every place that needs documentation; I can just let the compiler yell at me about it.
  • In related news, Effectum first release is basically done. All the basic tests are there and I got a big performance improvement by batching database operations together, so it can process about 50,000 do-nothing jobs per second on my laptop. Going to clean some things up and then the first actual release should come early next week.
  • Some future features will include auto-recurring jobs, the ability to cancel or modify jobs that haven't started running yet, and support for running the task queue as its own server.

2022-10-31

🔗
  • Effectum tests are underway and progress has been good so far. Found a couple issues but nothing major. It'll be nice to have this done and have a background job framework with no external dependencies, ready to drop into any future project.
  • Learning
    • Ran into a issue today with a Svelte component that dispatches an event when it first loads. It turns out that if you dispatch immediately then the event doesn't get handled, but you can work around this by dispatching in onMount instead. I created this example Svelte REPL to demonstrate the behavior.

2022-10-27

🔗
  • The MVP of Effectum is almost ready. Still a few more features to add, and lots of tests to write before it's truly ready!
  • Links
    • The creator of the swc Typescript transpiler has open-sourced his Typescript type checker project. Looking forward to seeing what comes out of this, since Typescript performance is a big pain point in modern development on large projects.

2022-10-25

🔗
  • Michael Lynch's post today on migrating from Cypress to Playwright struck a chord with me, as I had recently been setting up Cypress at work and encountered many of the same pain points that he mentioned. Having tried Playwright now, I'm a fan.
  • Github Copilot continues to be quite nice. It even appears to be aware of multiple buffers at once. When I was converting my Cypress tests, it actually suggested a nearly proper Playwright equivalent. Very impressive, and it saved me at least five minutes per test.

2022-10-22

🔗
  • I signed up for the Github Copilot trial today. Pretty impressed overall. The longer suggestions in Rust frequently need some tweaking to be completely correct (usually around specific type coercion), but it still is saving a lot of time.
  • Learning
  • Links
    • Falcon is a library for visualizing millions of rows of data within the browser.

2022-10-21

🔗
  • Back from vacation, and while I didn't get much done on Effectum, I did come closer to figuring out the structure of the job registry. By wrapping each job runner function with a closure, I can abstract away the need to represent all the different possible return types of each task, and instead just handle cleaning up the task and processing its result inside the closure.
  • This thread on the Rust forum describes the proper way to save reference a closure that also returns a future. The main thing to remember here is that you have to manually pin the future.
  • The remaining part here is figuring out how to deal with shared state (things like database pools and so on). The easiest way would probably be to set up a single context type for a worker, which all task types share, and use it as a generic type parameter.
  • Ideally, each task runner could have its own structure for the shared state, instead of them all needing to use the same one. Something like the Extension structure that various Rust web frameworks use could work. For the first version I'll probably punt on this though, just to get something up and running.

2022-10-10

🔗
  • Links
    • Navigate, don't search, A GPS for the mind, and Hyperlink maximalism by Linus are three good posts on how software can be more of a partner to our thinking process. Linus is one of the more original and interesting writers in the overcrowded "tools for thought" space and his writing is worth checking out even if you're not interested in the topic as a whole.

2022-10-06

🔗
  • Progress on Effectum is coming along as I find a couple hours here and there to work on it. Job heartbeat and checkpoint functionality is written. Next up will be some thought about ergonomic ways to start workers that can run multiple types of tasks. I may do something inspired by the job registry in sqlxmq.
  • Links
    • Haki Benita wrote a short article about writing SQL in a future-proof way by adding exhaustive checking to CASE statements. This way if an unexpected new value is added to a column, a query will throw an error instead of just ignoring it.

2022-10-05

🔗
  • We have a fair amount of legacy code at work which we're slowly converting to modernity, and one aspect of that is making Typescript pass in strict mode. I've found it useful to enable strict mode in the main tsconfig.json, while using a second tsconfig file to actually build the project that extends from the main file but turns off strict mode. This way we can still run checks and get the full set of diagnostics when developing, while allowing the build to still pass.
  • Links

2022-10-04

🔗
  • Implemented job insertion on Effectum today. I tried to be clever at first and prepare all the queries in advance when the Queue is created, but ran into issues where prepared rusqlite statements are not Send. That's ok though. The rusqlite prepared statement cache is close enough.
  • Links
    • LibSQL is a new SQLite fork. Whereas SQLite famously does not accept outside contributions, LibSQL is approaching it from a more community-based open source viewpoint. They're aiming toward some more "modern" features such as support of io_uring and perhaps WASM user-defined functions. We'll have to see how this turns out. SQLite's strict development process has also lead to a famously stable product, and I expect that it will be difficult to keep that same level of rigor. Still, if this picks up steam it could be quite promising.

2022-10-03

🔗
  • Implemented my first Rust future by hand today for Effectum . Wasn’t too bad actually, for simple cases. I ended up going a different route but it was nice to get the experience. The main job waiter loop is coming together, and next up will be adding new jobs and pulling them off the queue to assign to workers.
  • I switched back from Warp to iTerm2+tmux once again. There are still some rough edges with Neovim, but overall Warp has improved a lot in the past six months and I'm looking forward to the next time I try it again.
  • Links
    • Intuitive is a new Rust library geared toward declarative terminal user interfaces. Still in development, it seems, but it looks promising.

2022-10-01

🔗
  • Starting yet another side project because why not :) Effectum will be a SQLite-based task queue embeddable via a Rust library, and eventually it will also be a standalone project, which can be used over HTTP or gRPC. Just putting together the requirements now. This is mostly an excuse to play with SQLite a bit, but once this is in decent condition I'll probably start using it for both Ergo and Pic Store.

2022-09-30

🔗
  • Started up Warp Terminal once again to check out the latest updated. The various displays in Neovim all look correct now, which is great. And the notifications on finishing of long-running commands is welcome, since I'm frequently running long tasks in other tabs at work.
  • They've also added a quick session switcher (Cmd+Shift+P). Still would be nice to be able to switch between entire sets of tabs, like tmux lets you do, but I'm ready to give it another serious try.