-
byI made a fun hack for importing images. I'm using (part) of the Hotwire stack for the dynamic portions of Tanzawa. Most dynamic web applications today use client side rendering, which means the server sends a json data structure and your browser has code/templates/logic to instruct it how to turn it into html for display. Hotwire is "html over the wire", so all of your logic and rendering happens on the server and the browser just displays the result.
APIs traditionally return JSON. The image import api I wrote about yesterday also returned json, because that's what apis do. I was thinking the Javascript I need to write to update the page after an element has been imported when it hit me β if each photo in the list is wrapped in a turbo-frame, my api can return html, and all of my logic and rendering is in one place on the server. Perfect!
My plan was to then just write some Javascript that would traverse my list of images and call the api one by one. Then take the html response and replace the existing item.Β But then I noticed that Turbo frames can have a source url i.e. I could put my import api url as the source for the frame and Turbo would automatically call it for me.
Turbo also support lazy loading. Which means that it's not going to load the frame until it shows up on the page. Which means I can import all of my images by just scrolling down the page.
So rather than have a bunch of Javascript to control a queue to make an api call to manually modify some html/css on the front end, I just have a list of images that you scroll down and each call is automatically made with the results are automatically updated on the page. Simple is best. -
The Week #38
by- Exciting times in the Van Dyne household! The potty has suddenly clicked for Leo. We haven't been nearly as strict with Leo as some of our friends have been when it comes to potty training. We've taken the approach that "everybody eventually doesn't like wet diapers and grows out of it". Instead we've just been trying to make it a routine before the bath to give it a try. If he does, great and if he doesn't that's fine, we'll try again tomorrow.
- I had Leo by myself all day Saturday and I didn't change a diaper β at all. Not because he didn't pee, but because I asked him every 3 hours if he had to go, we'd try and he'd sit and do his thing. On Sunday we thought he was just doing his thing on the loo and he did his first #2 by himself. The end of diapers is quickly approaching!
- Part of having Leo all day Saturday meant we go out and ride the train. Leo wanted to ride the monorail. The monorail ends at Enoshima, so we can ride a bunch of trains and loop back to our house. Usually we walk down to the beach, maybe get a burger atKua`Aina then loop back.
However, a couple of weeks ago Leo went to the aquarium in Enoshima and it was likely going to be packed being it's a weekend and spring break. Even without the pandemic I'd avoid it. So we took the Enoden to Kamakura. I figured it was also going to be packed, but it was early enough we could avoid the crowds. We walked towards Tsurugaoka-hachimangu as there's a Tully's and I needed a break. But to my surprise it had disappeared!
We looked at the Sakura and koi for a couple of minutes and headed home. On the way back we saw the Narita Express, one of Leo's favorite trains. He also melted down as he wanted to ride it, but it wasn't at a platform for us to ride. If it was I would have paid the extra fare so we could take it a couple of stations home. - I linked to What is the Small Web on the Tanzawa blog, but felt it's worth calling it out on The Week, too. It's made by Small Tech (also worth a click).
Β Small Technology are everyday tools for everyday people designed to increase human welfare, not corporate profits.
Β Β Β Small Tech is exactly the banner to get behind. -
byI broke the chain with a weekend off after about 3 months of working on Tanzawa a bit each and everyday. Today I'm back at it and I made a small api that imports images from Wordpress. Tomorrow I should be able to build a small interface that'll loop through the attachments and automatically download them.
-
Protocols Not Platforms
byThe magic of web 2.0 were the open apis. Developers could use these apis to mashup services how they wanted. Sometimes these developer's tools and mashups became so popular that they would come to define the entire service of which they were building atop. Both hashtags and the term "tweet" originated outside of Twitter, Inc.
But when these services grew they morphed into platforms. Their apis were closed off and the developers that helped these companies find their success either kicked off or severely limited in what they could do. This became a pattern, not just with Twitter, but many services that found success in thanks part to their open api followed the same playbook.
Existing players making unpopular changes to their policies is usually a boon for the upstart. Each time this happens a vocal group of users becomes dissatisfied with the platform who then attempt to migrate to an alternative. However each migration causes some kind of loss. Data doesn't transfer or communities fracture because not everybody moves. Not to mention the energy that could have been spent doing something else.
Contrast this with something like email. You can email anyone you'd like, even if they don't use the same provider as you. If your mail provider changes a policy you don't like, you're free to change providers without losing your identity on the internet. People can still contact you the way they always had and you can still contact them. Your data can move from platform-to-platform seamlessly. There's nothing re-organizing or hiding emails from your inbox unless you setup the rules (or use gmail).
The difference in experience between twitter and email is night and day. One keeps you locked in and subject to their whims, while the other gives you the choice to use it however you see fit. The difference is that twitter is a platform and email is a protocol. Pick protocols.
-
byManaged to get the category to stream and post kindΒ to (tanzawa) post kind mappings working. I also got the attachment import records saving properly.Β
My basic plan for importing attachments is as follows. Each photo in Wordpress is exported as a post with the post type as "attachment". The guid for the item is the url for the attached file. So, I've created a record has a foreign key to the originating wordpress import record, the post guid, my own uuid, and a nullable foreign key to the resulting Tanzawa file attachment.Β
Once the file has been imported, I'll have a Tanzawa file attachment set so I'll easily be able to pick up where I left off.Β
Also since I'm keeping the originally uploaded Wordpress export file around and references between Tanzawa data and imported data, as I add features and capabilities to Tanzawa, I'll have the option to go back and pull in meta-data from Wordpress that I skipped on the initial import. -
byI've got the base interface for mapping categories to streams worked out. Adding a new stream directs you to the django admin, which isn't ideal from a user perspective, I kinda like it because modifying system data should be different.
The base category mapping interface -
byHave got the base upload form working. After uploading the file it's automatically creating placeholder records for all post formats (Wordpress' build in Post Kind),Β Categories, and Post Kinds.Β
But thinking more about the actual worflow, I think it will be better not automatically create those records and truly split it separate steps. So after uploading the file you're taken to a list page with a list of all uploaded Wordpress files.
Next to each filename there will be five buttons: "Set Category Mapping", "Set Post Format Mapping" ,Β "Set Post Kind Mapping" (if found), "Import Media", and "Import Posts".Β The "Import Posts" button will be disabled until mapping has been setup and media has been imported.
Uploading the file will automatically redirect you to the "Set CategoryΒ Mapping" page, but if you leave the process midway through you'll be able to pickup where you left off.The base Wordpress import form -
π What is the Small Web?
The Small Web is for people (not startups, enterprises, or governments). It is also made by people and small, independent organisations (not startups, enterprises, or governments).
On the Small Web, you (and only you) own and control your own home (or homes).This is exactly what motivates me to work and build Tanzawa. The world needs a smaller web focused on people. The Small Tech principles are also bang on. -
The Week #37
by- Technically this was last week, but my term as head of the neighborhood has come to an end. Although I was part of the physical education group (the most event heavy group), we didn't have a single event due to covid. Being new to the neighborhood and not renting, I was hoping to use this year to get more involved in my community and to get to know my neighbors / let my neighbors get to know me. Next year I'm the backup head of the block, so maybe that's still possible, once the vaccine rolls out.
- Speaking of vaccines, my friends in the US and UK are starting to get their covid vaccinations. While we've had a fraction of the case load as them, I can't help but feel a bit jealous. We're still inoculating at a slower pace than I'd like to see, but in a month it's increased a hundred to topping topped 70k per day. It's at least going in the right direction.
- I've decided to get a bicycle and went to a couple of shops to check out used ones. One was a one of Japan's great second hand stores, where they have a bunch of "used" products that are like new. And the other was a shop that specializes in used bikes. The staff was friendly and answered my stupid questions. I'd wouldn't mind buying my bike from them, but they didn't have the one I want.
I don't know what it is - maybe just a lack of knowledge of bicycles in general, but I always hate going into bike shops. It's not a Japan thing, as I've noticed in US as well. I always feel some serious in-group/out-group energy. Just me?
- I saw this cool project called Solar Protocol, which is an experiment to have a website hosted across the globe completely by solar power and sent from whichever sever has the most energy. I thought about volunteering as a server steward, but I'm not sure about how I can securely mount solar panel to my balcony, which has both great southern and western exposure (I'm not about to start climbing up on the roof).
- Lately I've felt like our water bills are a bit higher than they should be. For many it's because they're now at home all day everyday, rather than in the office, so their usage has increased. But we've been at home all day everyday for about 3 years. Since we bought our house, I had always thought our water pressure almost too good. Turns out the taps were fully open. I cut them back 50% - 60% and they're still getting great flow. This should reduce our usage (and thus our bill), but it will take a month or two for us to find out just how much effect this 30 second fix will have.
-
byGetting the base models used for importing Wordpress posts into Tanzawa built has made the task feel a bit less daunting. There's a clear path forward.