-
Checkin to Art Rink in 横浜赤レンガ倉庫
Getting some ice skating in with the fam. So hard. Leo’s doing good. 🙌🏻 -
The Week #130
by- Hard to believe that this is the last full week of 2022. I haven't yet gathered my thoughts for the year or made a roundup post as I usually do, but I'm relatively pleased with how the year's gone.
- I finished work for the year on Wednesday. I think this might be my first big break since this time last year. Otherwise it's been days off here and there because someone needs to watch Leo or we're sick with Covid. I felt like I really needed this break a couple weeks ago, which means I waited too long to take proper leave.
- The big event this week was the double-whammy of Christmas and my wife's birthday. We celebrated at the in-laws house with a small feast and cake on Christmas Eve. I went full American and made some rosemary-garlic roasted potatoes, a shredded carrot/apple/raisin salad, and cheeseball(!!). The cheese ball was only possible because my dad sent heaps of ranch dressing mix packets along with the heaps of Christmas cookies. So good. Much fat.
- As we're planning to visit American we decided not to get presents for each other, but as usual, Leo scored. Santa brought him the Adventures with Mario Lego Starter pack. It's about 10x cooler than I had anticipated. The Mario actually takes batteries which powers some scanners in his bottom. He audibly/visually reacts to the color that he's standing on, e.g. on red, he makes noises like he's in lava, and blue like he's in water and so forth. Even cooler though is the goomba / ? blocks / Bowser Jr. have a barcode block on them that Mario reads and he makes sound effects, or gets an item. If you lay him down his gets sleepy and falls asleep.
From mom and dad he got a Jet Kids carry-on luggage. It's cool as he can carry his stuff, but it can be placed in front of his seat to turn it into a kind of bed. Then we found out that United doesn't allow them to be used on any of their flights... As long as he's in the window seat, I don't think it'll be a problem if we use it (unless they explictly call it out when we board, otherwise I reckon we can just feign ignorance). - Side-project wise I merged that big refactor of Tanzawa's internals and it's working as anticipated – great.
I also added consumption scraping to Sunbottle. This means I can now see how much electricity I actually use again. I've started using it to show how much I generated and how much I consumed the previous days and it's quite handy. This feature sets the groundwork for me to start on the "billing" code, so I'll be able to have a page that shows how much my usage would've cost without solar.
But as the billing code is a bit too much like work, I've shifted focus to another Tanzawa feature I stated as a goal at the start of the year, didn't start because of tech debt I've recently paid off ( aforementioned refactor and moving from Gunicorn to uWSGI): Strava integration. It's coming along nicely and I think it'll get in before the end of the year...which leads me to... - I've been subscribing to Apple's Fitness+ for ages, not on purpose, but because it's included in Apple Ultimate (or whatever the tier is called that gives you everything for cheaper than increased storage, music, and apple tv). I went for my first run using Time to Run, and it's great.
Usually when I'm running I'd pick some music and a timer for 30 minutes or so and just go. You're left asking / deciding "what do I want to run to today?" or running into slow songs as the worst time. It's difficult to explain with words (and that won't stop me from trying!), but it is...like a coach in your ear and a tour of a city at the same time but it doesn't matter than you're not in that city.
At the start of the run the coach explains the run (3 difference paces, repeated twice etc..) / the city/course that this run is based on. The music is set for the location, pace, and cut to match the different sections. e.g. The first city was Miami, which has a large Cuban/Latino community, so all of the music was in Spanish and there was a nice 2 minutes of up-tempo song when it's time to run fast, slower songs when it's time to slow down etc..
Just as important is the reminders between each section for what to focus on. Focus on your breath and keeping it steady. Use your arms, keep them close and use them like a second set of legs.
I've only used it once, but it made a 33 minute run fly by. Not having to select music is one less thing for me to think decide when running. Having story and photos of the location pushed my watch while I run is entertaining. The couching and encouragement while running, even if it's from an audio recording, is somehow quite motivating during the run.
-
byThe problem with having two fun side projects:Do I write the Strava integration for Tanzawa so I can get all of my running data (or lack thereof tbh) just so.Or do I write some billing/electricity tariff calculations / #OctopusEnergy API integrations, so I can show just how much my solar / battery is saving me each month....I reckon Strava is more important/less like work code... We show estimated costs on our graphs...I bet I can use that instead of calculating things meself to start?
-
byRemember how places like LiveJournal used to have "post flair"? They were effectively different emojis for your mood or the weather. I think there were even some music integrations so show the song you're listening to...I think I need that on my blog. Weather could be done free with OpenWeatherMap/weather-icons. Music might be trickier...
-
Editing Bookmark / Reply Titles with HTMX
byThis post is a followup to Allow editing of replies/titles and describes some of the changes made to enable this functionality (#265) and my thoughts after my first steps with HTMX.Unable to change bookmark / reply titles ☹️
Above is the before state, which is a static view of title/url of a bookmark/reply. Below is a gif of what I built and the finished state. There's a new change button, which you can click to reveal a form that allows you to edit the record. This form allows you to save or cancel. Save updates the record and changes the screen back to the "read only" view, while cancel just loads the current "read only" view. Zero custom Javascript.Editing a bookmark url / title in Tanzawa
Powering this is two new simple views in the admin site. One loads the entry's bookmark/reply and returns the read only view. The other loads the same record and displays a form on get, updates it on post.
The htmx and these two small views were the simple part of this feature. The heavier lift was decoupling the Tanzawa micropub endpoint from the admin views/forms, and then updating the admin views to no longer expect IndieWeb extension data (reply/bookmark url/titles etc...) on update (it's still required on create).
Thankfully I had functional tests for my micropub endpoint, so I could be confident that my refactoring didn't break existing functionality. Those tests allowed me to extract the logic from the admin forms and put them into a application function. This new application functions are reused by all interfaces creating/updating entries.
The next phase was adding tests to the admin views and then updating them to use the common application functions. This work was mostly a slog because I needed to add tests and better factories for my tests before doing the actual refactor. There's still more improvement that can be made in the test factories to make them a bit more DRY, but they're good enough for now.
Working with HTMX has been a dream. Rather than using Javascript to tweak DOM, I can simply make calls to the backend to get html from the backend by adding just a couple of attributes to my template dom. All of this using the same django templates.
My next steps with HTMX are going to be to look into integrating django-components, so I can wrap up the Javascript I do need with the their templates/css and do some more refactoring. For example, right now reply/bookmarks have effectively the same templates / views duplicated. Using components, I should be able to have a single logical component to power both.
If the components strategy works, I will look at breaking out various parts of Tanzawa into htmx/django-components for easier maintenance e.g. the location selector or location view on the bottom of checkins. -
Response to
byThis PR started as an experiment with HTMX to allow Tanzawa to edit reply/bookmark titles. As all of the entry creation forms/views are inherited from similar base-classes for easy/speed of initial...
I've re-worked all of the create/update views for each post type to use application functions and added functional tests. Editing the url/title for reply posts, works really well. HTMX is allowing me to create the simple interactions I want without Javascript.
The biggest change is reply data is no longer updated all at once with the rest of the post, but rather when you finish editing the title/url, similar to how editing a GitHub PR title works.
The last bit that I think needs some more work, unrelated to the rest main objective of his issue, is the first step when creating a reply where I request the URL to, and it uses Turbo to fetch the meta-data / return a page that can create a reply.
This flow may need a bit more yak shaving so it doesn't use Turbo at all. Will give it a fiddle to see if I can refactor and simplify the flow using HTMX. -
The Week #129
by- After years of regularly and then sporadically saving for retirement, I've finally automated it again...kinda. If I were in the US, I'd have access to regular retirement accounts and things could be deducted in a tax efficient way from my pay check. As an American, I also can't take advantage of any non-US retirement savings schemes (🤪). So what I'm basically left with is depositing some amount into into a regular taxed brokerage account.
What I've setup is: an automatic from Wise to my US bank account, and a few days after an automatic withdrawal from my US bank account to Vanguard. The two bits I can't automate are: the wire/furikomi from my Japanese bank account to Wise and once the money is actually in Vanguard, purchasing of ETFs (VOO index funds, mostly). My hope is that Wise will send me an email with the amount I need to send in yen each month (because exchange rates change). - Setting this up makes really happy. It's been one of those tasks in the back of my head for quite a while and the crap exchange rate made it even less attractive. The exchange rate is still horrible (but less so). I reckon it will all even out in the end. But perhaps the best bit is I discovered I can now purchase fractional ETFs.
I'll explain. Let's say I have $200, and I want to buy 1 share of VOO (a S&P 500 index fund) that I'll sell off when I rewrite, and it costs $350. Normally,I have to hold my $200, not earning anything, wait until I had $350 and hope that by the time I did the cost hasn't risen to $400 and make my purchase. Now I can just buy $200 worth of the stock, which makes it much easier to invest the same amount each month, no matter the price of the stock. - There was a bunch of noise on the bird site with the owner doing stupid, stupid shit. Like blocking linking the other sites stupid. ON THE INTERNET. :facepalm: Good riddance. So glad I've made my home on the internet my own domain / IndieWeb enabled.
- I've been making really good progress on my major refactoring of the Tanzawa. This has me mostly pulling logic out of ModelForms and moving them into application/domain functions that I can reuse throughout my site. The create methods have been refactored and the update methods are mostly so. I reckon I'll need another pass at views themselves as they're a bit crufty, still.
- We had a Christmas social at work to celebrate the year and it was a lot of fun. We've grown so much in the past year. We went to Soul Food House in Tokyo. I've been wanting to try that place for years, but it's in central Tokyo – some place I'm not going to go unless I'm in the area. Maybe it was the classic American cooking, or maybe it was the Christmas poem read in an English accent, but it finally felt like Christmas is starting.
- Friday was Leo's Christmas pageant where the school puts on a play about the birth of Jesus and then they sing some Christmas songs. When thinking about the amount of chaos you'd expect at a pre-school production of...anything, and then reflecting on the various happenings (kids crying, kids running around, props falling over) that happened during the production...I came to the conclusion that there was just the right amount of chaos this year that it kept things interesting. Not enough and it gets kinda boring, "what are these kids? professionals?" you think to yourself. But they really hit the mark so well, I even heard one of the moms mention the chaos during the show. I'm looking forward to next year when it's Leo's grade's turn to have speaking roles...and maybe a bit less chaos.
- After years of regularly and then sporadically saving for retirement, I've finally automated it again...kinda. If I were in the US, I'd have access to regular retirement accounts and things could be deducted in a tax efficient way from my pay check. As an American, I also can't take advantage of any non-US retirement savings schemes (🤪). So what I'm basically left with is depositing some amount into into a regular taxed brokerage account.
-
Checkin to Starbucks
Coffee and handwriting practice. -
bySaw this flat with about 10 of those portable solar generators haphazardly hung on / around his balcony. Love it. Wonder how they’re actually using it….