• skip to sidebar
  • skip to search box

trainedmonkey

by Jim Winstead Jr.

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.)

» Friday, September 6, 2024 @ 6:25pm » talapoin, IndieWeb, bookmarks, pinboard » Bluesky butterfly logo » Comment

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:

  1. 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’s escape doesn’t take an argument. I was able to override it take an extra argument, but mostly ignore it for now.
  2. Jinja doesn’t have Twig’s ternary ?: operator. Not surprising, Python doesn’t either. I rewrote those bits of templates to use slightly more verbose if blocks.
  3. Jinja doesn’t have Twig’s string comparators like matches and starts with. Looks like I can get rid of the need for them, but I just punted on those for now.
  4. Jinja doesn’t have a block() function. I think I can also avoid needing it.
  5. Jinja’s url_for() method expects a more Python-ic argument list, like url_for('route', var = 'value') but Twig uses a dictionary like url_for('route', { 'var' : 'value' }). I was able to override Jinja’s version to handle this, too.
  6. 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.

» Saturday, June 15, 2024 @ 8:17pm » code, blogging, fads, python, talapoin, twig, Rust, SQLAlchemy, Flask, Jinja, Tera » Bluesky butterfly logo » Comment

Embrace the dark

view from victoria peak at night

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.

» Friday, May 31, 2024 @ 2:26pm » blogging, fads, talapoin, color-scheme » Bluesky butterfly logo » Comment

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.

» Tuesday, February 13, 2024 @ 11:41am » blogging, fads, talapoin » Bluesky butterfly logo » Comment

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.

» Friday, February 9, 2024 @ 2:13pm » code, talapoin, Bluesky » Bluesky butterfly logo » 1 comment, add yours

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.

» Tuesday, February 6, 2024 @ 6:55pm » code, search, talapoin, Elasticsearch, ZincSearch, sphinx, Typesense, Meilisearch » » Comment

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.

» Friday, February 2, 2024 @ 3:48pm » code, photography, talapoin, IndieWeb » » Comment

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.

» Tuesday, January 30, 2024 @ 9:08pm » code, photography, flickr, talapoin » » Comment

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.

» Wednesday, January 17, 2024 @ 11:13am » code, blogging, fads, talapoin, mastodon » Comment

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.

» Saturday, July 8, 2023 @ 1:54pm » blo.gs, code, fads, talapoin » Comment

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.

» Saturday, June 24, 2023 @ 5:42pm » code, blogging, fads, talapoin » Comment

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.

» Thursday, June 15, 2023 @ 8:56pm » blogging, fads, celia, wu tang clan, talapoin » Comment

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.)

» Saturday, May 27, 2023 @ 4:33pm » code, blogging, fads, talapoin, mastodon » Comment

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.

» Thursday, October 20, 2022 @ 5:56pm » code, php, blogging, fads, sql, talapoin, slim framework » Comment

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.

» Tuesday, June 14, 2022 @ 12:20pm » code, blogging, fads, scat, talapoin » Comment

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.

» Saturday, May 11, 2019 @ 8:55pm » meta, blogging, fads, talapoin » Comment

progress

yes, this is still on. and now it is on a new server with new code, even though it looks the same.

i still need to knock together the "writing a post" bit of code so that i can post without using manual SQL queries. details.

» Tuesday, April 23, 2019 @ 8:48pm » meta, blogging, fads, talapoin » Comment
  • Home
  • About
  • Archive
  • Bookmarks
  • Photos
  • Projects
  • GitHub
  • @jimw@mefi.social

Dedicated to the public domain by Jim Winstead Jr.