Entries tagged 'talapoin'
Put a pin in it
I did a first cut of moving my bookmarks on to this site instead of using Pinboard.
I still need to wire up a way to create new bookmarks, but that should be pretty straightforward.
Each bookmark can carry with it an excerpt and a comment. That way I can clip a little text for the bookmark while I’m creating it. None of the existing bookmarks use that yet because Pinboard did no such thing.
Things to be done aside from adding a way to add bookmarks include adding an Atom feed, really wiring them up to search, figure out how to be marking these up in a more IndieWeb-friendly way, and thinking about whether I want to take snapshots of the bookmarks. (Those would probably only be accessible to me to avoid copyright headaches.)
Is this Twig or Jinja? Maybe both!
A project I have been playing around with the last couple of weekends has been making a Python version of this site. The code, which is very rough because I barely know what I’m doing and I’m in the hacking-it-together phase as opposed to trying to make it pretty, is in this GitHub repository.
I am using the Flask framework with SQLAlchemy and Jinja.
I was interested to see if I could just use the same templates as my PHP version, which uses Twig, but there have been a few sticking points:
- The Twig
escape
filter takes an argument to more finely control the context it is being used in so it knows how to escape within HTML, or a URI, or an HTML attribute. Jinja’sescape
doesn’t take an argument. I was able to override it take an extra argument, but mostly ignore it for now. - Jinja doesn’t have Twig’s ternary
?:
operator. Not surprising, Python doesn’t either. I rewrote those bits of templates to use slightly more verboseif
blocks. - Jinja doesn’t have Twig’s string comparators like
matches
andstarts with
. Looks like I can get rid of the need for them, but I just punted on those for now. - Jinja doesn’t have a
block()
function. I think I can also avoid needing it. - Jinja’s
url_for()
method expects a more Python-ic argument list, likeurl_for('route', var = 'value')
but Twig uses a dictionary likeurl_for('route', { 'var' : 'value' })
. I was able to override Jinja’s version to handle this, too. - I’ll need to implement versions of Twig’s
date()
function and filter.
I had cobbled together a way on the Twig side to let me store some templates (side navigation, the “Hire me!” message on the front page) in the database, so my next trick is going to implement template loaders for both the PHP and Python versions so that is more cleanly abstracted. I have the Python side of that done already.
I hope to eventually create a Rust version of this, too, and it will be interesting to see what new complications using Tera will bring.
Embrace the dark
I finally took some time to implement a “dark mode” style for this site. It will default to whatever you have your system set to, but there is also a set of radio buttons that you can use to force it to a particular mode. (It doesn’t save the setting, so you will have to do it on every page if you are browsing around.)
This talk by Sara Joy about light mode and dark mode was part of the inspiration for getting around to this, and this article about light-dark
from Bramus is where I stole borrowed the idea for handling the mode switching.
Because I am using the relatively new CSS light-dark()
function to implement this, it is possible (likely?) it will degrade less than gracefully on older browsers.
Now with a different style
It has been almost six years since I did much to the design of this place, and I figured it was time to pay a little attention to it. Nothing major, just some tweaks to the colors, finally applying a little more style to the forms, and generally just cleaning things up. I will keep tweaking things. I have an SVG version of the “Barrel of Monkeys” monkey that I want to incorporate into the logo but I want to try and simplify it and get it down to a size where I am okay with putting it inline into the HTML.
I am using CSS nesting for the form styles which should be okay with recent browsers. Everything should degrade pretty sensibly, or maybe abruptly. It is great that the state of the art for CSS is advancing fairly quickly again and it is possible to do fun stuff without having to adopt big frameworks or tools that require a build step.
I used Adobe’s (free) Color Contrast Analyzer to pick the colors and (try to) make sure they were accessible.
Not sure what’s next, but dark mode is on the list somewhere.
More syndication
Now that Bluesky is available without a waitlist and has a web interface, I have been playing around with it a little more. So in that spirit, posts here will get posted there just like I’ve been doing for Mastodon.
I’m just using this PHP interface for Bluesky because it was what I ran across first, but I probably should use Ben Ramsey’s socialweb/atproto which looks like a more rigorous implementation of the underlying AT protocol.
Anyway, it’s hacked together for now, and the very few followers I have over on Bluesky will now perhaps find these things in their feed.
You can even find links to the posts on Mastodon and Bluesky in the details of the entries here. One of my plans is to eventually pull in replies on either of those as comments here based on jwz’s hack for doing that with WordPress.
Sometimes the hammer is too big
Elasticsearch is something I have seen pop up in a lot of job listings, so I decided to play around with it to see if I could use it for the search on this site. I was able to get it set up fairly easily on my development server and shift over to using it there, but when I tried to bring it up on my production server, I ran into the problem that it is more resource-hungry than it can handle. This all runs on a Nanode, which is Linode’s tiniest virtual server that just has 1GB of RAM.
Right now I am using Sphinx which has been fine, but it hasn’t really been open source for quite a while.
I was going to try playing around with ZincSearch next. I was digging into it and it certainly sounds similar to what I want (a “lightweight alternative to Elasticsearch that requires minimal resources”) but it isn’t clear how active the project is or what sort of future it has. The documentation for ZincSearch is pretty but kind of scant. Looking into the search types it supports, I was left with questions about what syntax the querystring
type actually supported. So I looked at the code (which is slow reading since I am still fairly unfamiliar with Go), which I followed to the underlying bluge indexing library, which has even less documentation. I finally figured out that bluge was forked from bleve (which seems like something that would be nice to mention in the README
for bluge, but whatever). Bleve has the query string format documented. (Whew.)
But after all of that digging, I’m less certain about how much time I want to put into playing with ZincSearch since the underpinnings and their future seem shaky.
Typesense or Meilisearch is on my list to give a try next.
But in case it isn’t obvious, the things I have been digging into are sort of scattered right now.
Now the photos live here
I’d call it maybe an alpha release, but a very basic version of my photo library is now up and running. There is one last picture I need to migrate over from my old Flickr presence, but otherwise they should all have made it over. I should look at pulling in the photos from my Instagram account. The real test of things would be to load my iCloud photo library, but that is about 25,000 pictures and I’d certainly have to go through to see what could be public. It would probably be better to figure out how I want to get photos into the library going forward, and then I can back-fill photos from before this year.
Just implementing this has made me think a lot about how my system here is structured, how the data is structured, and how I want to structure it. I am trying to move towards adopting more of the IndieWeb principles and standards.
Some notes on Flickr data migration
I decided to stop renewing my subscription with Flickr recently to create some incentive for me to self-host my photos and integrate them more closely here. Before my subscription lapsed, I requested an archive of all of my Flickr data, and now I am finally getting around to working with the data.
When you download your Flickr data it includes JSON files named like photo_50626142.json
and JPEG files named like young-mimes_50626142_o.jpg
and the name of the JPEG is not in the JSON data.
You can generate it, probably, using the name and ID but I’m not sure what the rules are for turning the name field into the snake-case form.
Except that images without a name have JPEG files named like 17483805680_f57f81feb5_o.jpg
. The id is at the beginning, the other bit is just random or something. (Looks like this is the same filename used for the original
URL in the JSON.)
The way to go seems to be just matching on the ID embedded in the filename. (That’s what the one other tool I’ve seen that uses the export data does.)
And when working through all of this, I found that I must have not downloaded one of the archive files from Flickr, because I was missing 83 JPEG files. I was able to use the JSON files to rescue them.
Now that I know that I actually have all of the data and all of the images are in a Backblaze B2 bucket fronted by Gumlet, the next step will be loading all of the relevant metadata into a database table and then wiring up some ways to browse the images here.
Titles are where I can be abstruse
When I added auto-posting of entries here to my Mastodon account, it just took the title of the entry and posted that along with the link. But those end up being kind of cryptic, so now I made it possible to actually write the Mastodon post alongside the blog entry.
Just a small step in building out this online presence more fully and making sure it’s connected to other places more thoughtfully.
The next thing I want to do is build a new home for my photos. I stopped renewing my Flickr Pro subscription. I’ve thought about setting up a Pixelfed instance but that seems like overkill. I may use it as an excuse to build something in a language other than PHP because my resume could use that. Nearly all of my non-PHP work has been lost to me because it wasn’t open source.
pinging blo.gs again
i guess it only makes sense that i should ping blo.gs when i post things here.
hard to believe that thing has been running for over twenty years now.
now with new comments
not that i think that there is anyone reading this, but you can now comment on entries for seven days after they have been posted.
you can throw html in your comment, but it will get filtered by html purifier.
spam will be deleted promptly if it wasn’t already blocked or sequestered by akismet.
now with old comments
slowly rebuilding the scaffolding beneath this blog and i re-enabled the display of old comments, which led me to re-discover the time when random people would get mad at me because i mistakenly said redman was a member of the wu tang clan.
what really cracks me up in the comments is my wife celia casually noting that she had dinner with odb and had talked to him about being confused as to wu tang clan’s membership.
you can’t post new comments. i am still deciding if i want to implement that again and deal with all the nonsense that will come with it.
tooting while blogging
i figured that i should do something clever like automatically post to my mastodon account when i posted here, but i was surprised to find that the state of mastodon api clients for php is pretty sad. php-mastodon was what i used to get it working, but it's really an incomplete implementation and the error handling is pretty much non-existent so it took way longer than it should have to get going.
(and put me down as someone who is glad that “tooting” is being pushed into the background as the term of art for posting on mastodon, but couldn’t resist using it this time.)
migrated to slim framework 4
a couple of weeks ago i finally took some time to upgrade the code for this blog to the latest major version of the slim framework. it is still a strange mash-up of framework and hand-coded sql queries and old php code but this should make it easier to for me to tinker with going forward. the main thing i need to do is add a way to post images again.
another three years
another three years between entries. some stuff has happened. the store is still going, and i am still finding excuses to code and learn new things.
i wrote before about how i was converting scat from a frankenstein monster to a more modern php application built on a framework, which has more or less happened. there’s just a little bit of the monster left in there that i just need to work up the proper motivation to finish rooting out.
i also took what was a separate online store application built on a different php framework and made it a different face of scat. it is still evolving and there’s bits that make it work that aren’t really reflected in the repository, but it’s in production and seems to sort of work, which has been gratifying to get accomplished. the interface for the online store doesn’t use any javascript or css frameworks. between that and running everything behind cloudflare, it’s much faster than it used to be.
now i’ve done it
i noodled around a little more, and came up with an ugly way to supply and extract tags in my postings via email. the next step will be extracting attachments so i can post images again.