Tinboard v0.3.0

Posted on 2023-12-23 08:49 +0000 in Coding • Tagged with Python, terminal, textual • 2 min read

It looks like I'm in a wee period of small incremental changes and release of Tinboard. This morning I've release v0.3.0, which has a couple of small but useful changes.

The first is more of a cosmetic thing. The Footer widget in Textual is handy for showing the current keyboard bindings in a given context, but it can get massively cluttered very quickly (we do have plans to revisit this); in Tinboard this clutter creep was turning into a thing.

So I've removed almost every binding from being displayed in the Footer, and have placed an emphasis on the user pressing F1 to get context-sensitive help, and have also left the most useful bindings in the footer with very minimal descriptions.

Given that this is a keyboard-first application, and I've tried to make the bindings easy to remember, I think it's going to make more sense to do it like this, and will make for a tidier UI too.

There is one disadvantage here of course: by removing the display of bindings from the footer, the mouse-heavy user becomes disadvantaged; if a particular binding doesn't have a UI feature that favours the mouse to cover it too there's no way to initiate that action with the mouse. I'm going to think on this a little. Again, Tinboard is designed for me first and foremost, and my preference is to be keyboard-first when using the application; but finding a good compromise would be advantageous when it comes to advising people asking about Textual application design.

The second change is a simple but useful one. I've added a toggle of the sort order of the tags menu in the left-hand column (bound to F4). Right now it simply toggles between alphabetical order, or bookmark count order (most to least). At some point I might make it more of a cycle than a toggle, but this serves my purposes for now.

Tinboard can be installed with pip or (ideally) pipx from PyPi. The source is available on GitHub.


Tinboard v0.2.0

Posted on 2023-12-21 09:29 +0000 in Coding • Tagged with Python, terminal, textual • 1 min read

Following on from the initial full release a couple of days ago, I've just released v0.2.0 of Tinboard. There's just one small change in this, but I think it's a really useful one.

In the top-left corner of the screen there's a menu of main filters, letting you switch between seeing all bookmarks, or a combination of read, unread, public, private, etc... In using the application I quickly realised that it would be handy to have bookmark counts in that menu.

So I added that:

Counts in the filters menu

These counts are a little different from those in the tags list, in that they always show the number of matching bookmarks amongst all recorded bookmarks, not just those currently on display (and so subject to any sort of filter that's in play).

I think this is the right approach here. I know for sure that that's what I want from this, and I am writing this for me after all...

What's handy about this is that it makes it easier for me to see how many bookmarks haven't been tagged, and also how many I haven't looked back over and marked as read. This is already helping me get to untagged-zero.

Tinboard can be installed with pip or (ideally) pipx from PyPi. The source is available on GitHub.


Tinboard

Posted on 2023-12-19 09:47 +0000 in Coding • Tagged with Python, terminal, textual • 2 min read

Over the past few weeks I've been working on a new pet project, in part done as a Textual "dogfooding" project, but also because this is a tool I've been wanting for a while now: a terminal-based client for the Pinboard bookmarking service.

The dogfooding side of the development has been helping, uncovering a couple of fun bugs in Textual; plus the act of building this has let me try out a few of the newer features we've recently added to the framework.

What's really important though is this is a tool I actually wanted, and I'm using pretty often. I've written a lot of Textual-based applications over the past year, most small examples, some quite a bit bigger, but none of them really form part of my daily workflow. This changes with Tinboard.

Tinboard in action

Tinboard is designed as a fully-featured client, allowing for the creation of new Bookmarks, complete with tag suggestion support:

Adding a new bookmark

Not only are tag suggestions pulled from Pinboard, but entry of tags can auto-complete, taking completions from both the suggested tags and also tags used amongst your own bookmarks:

Auto-complete of tags

That feature was really easy to add thanks to the Suggester API.

Thanks to the recently-added TextArea widget the add/edit dialog allows for proper full editing of the extended text description of the bookmark too:

Editing a bookmark

One caveat here is a lack of word-wrapping; but this will be arriving in an update to Textual early in the new year.

As well as all the usual add/edit/delete facilities, Tinboard is also designed to make it pretty easy to find bookmarks too. There are filtering options for seeing all read/unread, public/private and tagged/untagged bookmarks; this makes bookmark management really easy for me because I can filter for all the untagged and private bookmarks, which are likely the ones that need editing and expanding on, and tidy up my bookmark library.

There is also, of course, full text search too.

Text search entry

When a filter or search is in operation, the related tags and the like react too:

A search result being shown

Another thing I've made a point of doing in Tinboard is leaning pretty hard on the Command Palette. No functionality is only available by it (I've done my best to make sure that keyboard is the primary input device here, with keyboard shortcuts for as much as possible). Initially I approached this as a "for the sake of completeness" feature, but already I'm finding that it's a pretty quick method of pulling up a tag filter.

The command palette in action

To help make all the features as discoverable possible, I've also ensured there's a pretty comprehensive help screen:

Help

Anyway; that's v0.1.0 out in the wild. I'm pleased with how it's turned out and there's a few more things I'd like to add. It's licensed GPL-3.0 and available via GitHub and also via PyPi. If you have an environment that has pipx installed you should be able to get up and going with:

$ pipx install tinboard

I hope this is useful to someone else. :-)


Steam Deck

Posted on 2023-12-14 16:47 +0100 in Tech • Tagged with gaming, Steam, Steam Deck, hardware • 4 min read

Back in 2021, I think it was, when Value first announced the Steam Deck, I was all "hell yes sign me up!"; like... really, I signed up there and then to go on the waiting list. The idea of a wee device that would let me play a ton of games in my Steam library seemed like a great idea. The price seemed right too.

So, I signed up, and waited, and waited, and life moved on.

When I finally (I think it was the best part of 18 months later?) got the email saying my Deck was up for grabs and did I want to complete the purchase I... said nah. By this point I was so heavily into VR gaming that mucking with stuff on a Deck didn't seem to make much sense to me any more.

I moved on.

Then a few weeks back they announced the OLED version and I took a second look. There was now over a year of reviews to read, hacks to notice, fun to follow; now I could get an idea if a Deck was any good and if it was for me. So after a bit of review-reading and review-watching, Thursday last week, I slapped down an order; and by Tuesday the Deck turned up.

New Deck getting going

The overturning of my original decision to not buy came down to a couple of things. The first was: I recognised that there were a lot of games in my library, sometimes things I'd bought (often in a sale), sometimes things I'd got as part of a Humble Bundle, that just never got played. This, I noticed, was sort of down to an unfortunate relationship I'd developed with gaming.

See... VR has won me over. I love gaming in VR. Also, I love recording my gaming sessions and throwing them on YouTube. This means that, to some extent, in my head, there's effort to getting going with playing a game: I've got to power up the Windows PC; I've got to let it update stuff; I've got to let Steam update stuff; I've got to power up the VR headset; I've got to get it to connect to the PC (which generally works fine but on occasion needs a complete restart of everything); I need to decide what I'm playing next and what to record; I've got to get the recording software going; I've got to...

You get the idea.

Also, of course, I've got to be in the right state to be okay with having a computer strapped to my face (sometimes you don't feel 100% and being lost in a virtual world isn't the best thing to be doing).

This can feel like too much effort. It also means that gaming tends to be left for when I've got a few hours to dedicate to it.1

But I also love playing games.

My thinking then was a Deck would be a great way of "forcing" myself to play the more casual stuff. There's no easy (that I know of) way to record or stream from the Deck; it's also easy to have it on the sofa and turn it on in a moment. This felt like the ideal device to have to hand, that was dedicated to gaming, and which would encourage me to take smaller gaming sessions when the time arises.

Like... sometimes I'll put something on to cook, come into the living room, pick up the tablet and scroll through the Internet. While I try not to doom-scroll too much, I can see that it would be more healthy to pick up the Deck and play DooM!

So far, two days in, I'm convinced this was an excellent idea and I'm totally won over.

My Steam Deck and Stream Deck

I'm still getting a feel for what does and doesn't work best on the Deck, from a "my taste in games" point of view, but things that allow for dipping in and having a quick blast are winners.

Hong Kong Massacre has finally got a play, despite me owning it ever since I saw John Wick 4.

Hong Kong Massacre

DooM II got installed and is working well -- I may have to slowly play my way through the whole thing. I've also installed Abyss Odyssey and so far am finding it quite charming and fun (it's an example of a game that isn't really my kind of thing; but I got it in a Humble Bundle, I think, and it's been sat there with 0 hours for way too long).

I've also failed to resist one of the more questionable titles from my younger days...

Come get some

The real surprise for me though has been a game I bought on a whim a couple of weeks back, which was going cheap, looked fun, seemed nice and casual and which I installed on the PC and totally ignored (because, again, turning on the PC to have a quick game seems like a lot of faff): Brotato.

Brotato

This game is frantic, way over the top, kinda confusing in parts (for me) but accessible enough that I can actually have a ton of fun with it; and what's really important is that I can pick up the Deck, turn it on, play a game of this for 10 minutes and then go on to do the thing I needed to do next. It's the perfect game to play while waiting for the next step in dinner to cook.

So, yeah, The Steam Deck... I'm won over; I'm so won over. And I haven't even properly explored the fact that it has a full GNU/Linux desktop inside it that I can use as a desktop machine...


  1. Some of this is also true with gaming on the PS5; while it's easier to turn on and get going, and while I don't have a VR setup for it, I do have it in my head that it's more for "epic gaming" than quick casual stuff; see Death Stranding or Cyberpunk 2077 for example. 


When it doesn't just work

Posted on 2023-12-08 10:32 +0100 in Tech • Tagged with Apple, watch • 3 min read

My journey into the Apple ecosystem has been gradual but all-consuming. I've gone from, around a 8 years ago, being unconvinced about how good the whole Apple world is, to pretty much having all the hardware they make available, in some form, that I have an actual use for1.

One of the devices I was late to, but won over by, after moving away from Android to iPhone, was the Apple Watch. These days I have two: the original SE, and also a Series 8. Generally I've marvelled at just how seamless the experience is. I swap watches: the connection to my phone "just works" and it figures all that out. Stuff syncs. Stuff stays in sync.

I lean heavily on the watch. The Series 8 is my daily driver, and the SE acts as my nighttime tracking device while the 8 charges and I sleep.

I record walks. I record runs. I record lots of heart rate data. I pay for things, pretty much everything, with it. I... take it for granted really.

My main watch face

Yesterday though, something odd started to happen. I noticed that some things didn't seem to be syncing from my watch to the phone. Health-related things weren't turning up. A recorded workout didn't show. The control of all things audio seemed to decouple and the watch kept taking over use of my AirPods from the phone in an annoying way I'd never experienced before. Things like that.

I tried a reboot of the watch. Stuff turned up.

It happened again. I tried a reboot of the phone. Stuff turned up.

It happened again.

I then rebooted watch and phone, stuff seemed fine, and I didn't think much more about it.

Then this morning I swapped from the SE back to the Series 8 as I sat down for breakfast, my usual routine, and the syncing was failing again.

This, for me, this is when Apple stuff gets really frustrating. There's no easy or obvious way to diagnose what's going on. Like: I could not sync some health data from the watch to the phone, but I could use "Find My" to ping the watch (presumably a difference in communication route, BT vs Wi-Fi perhaps). There's no obvious error dialog. There's no obvious log to look at. There's no "your BT is borked" alert or something.

Searching online the advice seemed to be the nuclear option: unpair the watch, reset it, start again. So I've done that this morning and it's been quite the pain. Getting it set up again was straightforward enough, but having to go through the whole thing of dismissing all the "here's some tips on how to use this watch you've had for a year and used every day" cards was annoying, also having to set up my payment cards again was annoying. Also, and this is on me for not backing them up recently, trying to recreate my watch faces from memory and remembering which ones they were based on was also annoying.

Apple are actually so good at a lot of this seamless shit; but damn do I wish they'd also be good at making a tool that lets you easily and smoothly diagnose some issues. I would imagine sync issues between watch and phone are common enough that a wee tool where you run through diagnostics, and where there's a Q&A to help narrow down the issue, would be a great experience.

Anyway... it seems to be up and running again, so hopefully that's that issue solved. I tried a couple of things that would need to sync from the watch to the phone and they showed up instantly; actually faster than I've been used to for quite a while.

Fingers crossed...


  1. During a conversation about this at work the other week, I think I figured out that the only Apple product category in which I don't own an example of the hardware is displays2. :-/ 

  2. When the VisionPro comes out I'll be able to say there's two. 


Fender Mustang Micro

Posted on 2023-11-05 20:28 +0100 in Life • Tagged with music, guitar • 2 min read

The urge to go gadget crazy, when getting a new hobby, or reviving an old one, is a real thing. Having recently bought the new guitar with a view to trying to learn to play properly, it's something I'm very mindful of and doing my best to avoid. However, in the middle of the week I did crack and buy one little extra thing:

Fender Mustang Micro

As I said in the previous blog post about the guitar: I ended up getting something that could be played acoustic without being annoying for neighbours, which in turn meant I didn't need any sort of amp, or pedals, etc. This has been working out just fine. But early last week, in an idle moment, I was looking up what might be good options for a small amp for practising should I want to and I stumbled on the Mustang Micro.

Reading up on it and checking out some reviews, it sounded perfect for my setup. I enjoy living in a small space, so could do without a proper amp kicking about, so something that just plugs right into the guitar sounded ideal.

I added it to a list of things to keep in mind and then... a couple of days later I was working from home which meant I'd be about to receive a delivery if I was to place an order and... oops!

I've been using it every day since it turned up and I'm so damn impressed! This thing might be small, but it's pretty mighty! For a complete notice like me, to muck about, and fiddle and get some great sounds out of it, I couldn't have asked for anything more.

The Options

The range of amp styles is way more than I could possibly do justice right now, but what's important for me is it's got versions that are nice and clean, and versions that are dirty and distorted. The effects are pretty much spot on too; there's everything I could ever possibly want there.

My only real complaint about it is that the UI itself -- small lights that use colour to indicate their setting -- is terrible. I don't know how else they could have done it, but I know this is bad. I am at least grateful that it's standalone and doesn't require some app on a phone to control or something like that.

I know it's going to take a while for me to get the most out of this, but already it's giving me a bit more confidence to experiment and doodle away in idle moments. Also, the USB connection means it can be plugged into my Mac, presumably allowing me to record with GarageBand or similar software. While I wouldn't use it to subject anyone to my terrible playing, that will be something for me to explore in terms of keeping a record of my progress.


Evolve Words

Posted on 2023-10-31 21:39 +0100 in Coding • Tagged with Python, evolution, biology, terminal, textual • 2 min read

This follows on from my previous post. If you've not read that, it's worth having a dive in first for the background.

The Ruby code I mention, that was written back in 2008, was actually a pair of scripts. The first one, called selection, did what visual-selection does, only visual-selection does it with a nice TUI interface: it takes a random collection of letters and symbols and evolves them into a target phrase.

As covered before: I don't remember all of the details of the conversation that was going on at the time, but I do seem to remember something along the lines of "yes, but you start out and end up with something the same length" and "nothing more complex is made" (let's gloss over the whole "complex" thing for now... well okay let's just gloss over it, end of story; this is just a fun coding exercise).

What I do remember is that the seed of an idea was planted. Fine: how about I start off with one small word, and using a list of English words as the "fitness landscape" that the mutations had to survive in, mutate a population over and over and see what happens. Would I "randomly" create known words, with fewer letters, with the same letters, with more letters?

So this version of the code randomly did three forms of mutation: it would randomly flip a letter, or randomly delete a letter, or randomly insert a random letter. It would do this over and over and eliminate words that aren't in the original list (the simple form of selecting for survival within the landscape).

Like I said last time: never going to convince anyone of anything, but fun to write some code.

This version became selection2.

So, having turned selection into a TUI application with Textual, I had to do the same with this code...

Evolve Words

As before, because it's fun to do so, this leans heavily on the worker API and textual-plotext.

If you want to check out the app itself there's a GitHub repo and it can also be installed from PyPi using pipx.


Visual Selection

Posted on 2023-10-26 18:50 +0100 in Coding • Tagged with Python, evolution, biology, terminal, textual • 4 min read

Over the last few weeks I've had a couple of sessions of working on a library to wrap Plotext -- a popular terminal-based plotting library for Python -- so that it can easily be used in Textual apps; textual-plotext is the result.

I feel it's come together pretty well

But... I've been itching to find a reason to use it in a project of my own.

Meanwhile...

Back in the mid-2000s, when phpBB systems were still the fashion, I used to hang out on a site that was chiefly aimed at the atheist and secular humanist crowd. We'd get a good number of drive-by YEC types who'd want to argue (sorry... debate) and often talk nonsense about biology and the like.

Now, I'm no biologist, I'm no scientist, I'm just a hacker who likes to write code for fun and profit; so any time there was a chance to write some code to help illustrate an idea I'd jump at the chance. I forget the detail now -- this was back in 2008; 15 years ago as of the time of writing -- but one time I remember a conversation was taking place where someone was just flat out claiming that "random mutation" can only cause "loss of information" and could never lead to a "desired result", or some such thing.

If you've ever had, read or watched those debates, you'll know the sort of thing I mean.

So that got me thinking back then, could I write something that could give a simple illustration of how this doesn't quite make sense?

So I had a little hacking session and came up with some Ruby code1 that did what I felt was the job. You'd give it a phrase you wanted it to generate (a stand-in for the current "fitness landscape", in effect), it would then generate a totally random string of that length, and then would set about mutating it, finding mutations that were "fitter" than others (a stand in for selection), breed the best two so far (randomly copy one chunk from another to create a child), then repeat over and over.

When I first wrote it I wasn't sure what to expect; would it ever finish given a reasonably large target string?

It did.

It was fun to code.

It got posted to the BB and of course wasn't in any way persuasive to them (honestly I never expected it would be). I seem to recall it being hand-waved away with calls of there obviously being an intelligent designer involved2.

Anyway, the "meanwhile..." in this: a few times this year I've thought it could be fun to rework this in Python (it's really not that complex after all; just a string-chopping loop really) and use Textual to put a fun UI on it.

So, that's what I did, complete with textual-plotext plot:

Visual Selection in action

While, 15 years on, this isn't going to convince anyone of the underlying point, I think it does serve a good educational purpose. It shows that you can create a fun UI for the terminal, with Textual, with not a lot of code. It also shows off how you can easily create dynamic plots. Plus -- and I think this might be the really important one -- it shows you can write "traditional" tight-loop code in a Textual application and still have a responsive UI; all thanks to the worker API.

The heart of the code for this application is this:

environment = Environment("This is the target string we want to create!")
while not environment.best_fit_found:
    environment.shit_happens()

Sure, there's some detail in the Environment class, but you get the idea: while we've not hit the target, let life find a way. A loop like that would totally bog down an application with a UI without some other work taking place. With Textual and workers the resulting method in the application, complete with code to send updates to the UI, really doesn't look much different:

@work(thread=True, exclusive=True)
def run_world(self, target: str) -> None:
    worker = get_current_worker()
    environment = Environment(target)
    iterations = 0
    self.post_message(self.WorldUpdate(environment, iterations, *environment.best))
    while not worker.is_cancelled and not environment.best_fit_found:
        environment.shit_happens()
        iterations += 1
        if (iterations % 1000) == 0 or environment.best_fit_found:
            self.post_message(
                self.WorldUpdate(environment, iterations, *environment.best)
            )
    if environment.best_fit_found:
        self.post_message(self.Finished(iterations))

I honestly think the worker API is one of the coolest things added to Textual and I so often see people have real "woah!" moments when they get to grips with it.

Anyway... I've covered science, religion, and how Ruby is better than Python, so I'm sure I've annoyed almost everyone. Job done I guess. ;-)

If you want to check out the app itself there's a GitHub repo and it can also be installed from PyPi using pipx.

Expect it to be my tinker project of choice for a wee while; there's a couple of other things I'd like to add to it.


  1. Possibly unpopular opinion with some folk who will read this, but I've long been a fan of Ruby as a language and actually generally prefer it to Python. 

  2. Me, the coder. While utterly missing the point of a simple illustration, while apparently not understanding the concept of an analogy, I guess at least they felt I was intelligent? 


Constant Siri voice loss

Posted on 2023-10-20 13:04 +0100 in Tech • Tagged with Apple, iPhone, Siri • 1 min read

This seems to have started with iOS 17, and I can't narrow down the how and the when of it happening, but over the last week or so I've found that every couple of days Siri seems to lose their voice. By this I mean the high quality voice that's used when they speak seems to disappear. I notice this when I ask my phone or headphones a question or to do something, and I get a really low-quality voice that speaks back to me.

The voice itself seems to be a version of the voice I normally use, but like it's using an on-device much-cut-down version. If I go into the settings to check what voice is selected, it's the one I normally use, but it wants to download it again.

Downloading the voice all over again

Sure enough, once the download is complete all is good again. I've not kept track of when it happens -- and I think I should from now on -- but it feels like it happens every couple of days; I almost always notice it first thing in the morning, the first time I ask the phone or the headphones something.

I hope it is some sort of iOS 17 weirdness and is gone when 17.1 turns up.


A new guitar

Posted on 2023-10-20 08:39 +0100 in Life • Tagged with music, guitar • 3 min read

This one has been brewing for a year, more or less. Now that I commute into and back from Edinburgh most days of the working week, I find myself walking past a couple of music shops. Seeing these reminds me of the days, back in my 20s, when I mucked around in a couple of bands and had fun making noises on a bass guitar. Since that time I've also owned a cheap six string electric, which is currently in storage (and has been since 2016) and an acoustic, which I have with me but I live in an apartment building and I'm not an arsehole so I never play it.

So, yeah, walking past those shops has made me want to muck about on a guitar again. I've never properly learnt the guitar, I've just managed to learn enough chords to make some noises I like for my own amusement, but even then I've not picked one up since around 2016 and what little I do know is very rusty.

Add to the above: earlier this year I was at a friend's and admiring her collection of bass and six string guitars and picked a couple up and realised I could not play anything. It had been too long, I'd lost most muscle memory and coordination, and what little knowledge I had.

So this made me want to fix this even more.

Given the apartment thing I decided on a plan: how about I get an eclectic, and then some sort of amplification that would always rely on headphones? Given such a setup I could knuckle down and try and learn properly.

So, this week, being on holiday, I told myself I'd pop into Edinburgh one day and have a look at my options; perhaps even come home with something. Yesterday was that day.

It didn't quite go to plan, but the outcome was that I ended up with something to play.

My new Höfner

So, on getting into the shop, and explaining what I was after and why to the chap in there, I tried the usual Stratocaster and Telecaster thing. Both were fine (I think I liked the feel of the Telecaster more in my hand). I had one eye on a Les Paul too, but never tried that. What I did see though was this rather lovely black Höfner.

Now, of course, it's hollow body, so sort of has that acoustic thing going on. This isn't what I wanted for playing in an apartment. But I had to try it anyway. As soon as I started dabbling I was sold. The sound was enough that it would be easy to pick up and play without having to faff with amplification of any sort, on the other hand it was nowhere near as loud as my acoustic. I felt like it bridged the gap between easy to pick up, and versatile enough should I ever want to plug it into something.

And... let's be honest: it was black. Sooooo black. I like black.

Long story short... it had to come home with me!

As mentioned earlier: most of my guitar stuff is still in storage, from when I moved to Scotland, but I did find my old tin of plectrums and the tuner.

Standard guitar kit

(Yes, the tin was once mine and was once full; the early 90s were a different time)

I even found one of my old stands, that I've had since around 1991! So now it's set up in my living room, next to the PCVR rig, ready to go at a moment's notice.

On its stand, ready to go

This is my plan now: each weekend I aim to put in at least an hour a day of practice, to try and get my fingers up to strength again, and to build up the muscle memory of where the strings are, to get the coordination between both hands, etc. I'm also going to be working through beginner's lessons from a tutor application. I'm going to treat this like I'm the complete novice I am and slowly work on improving.

There's no end goal; other than just get proficient enough that I can muck about on my own and be happy that I can play the sorts of things I want to be able to play.

Also, it's good to learn new stuff, especially new stuff that isn't just more coding.