The place where random ideas get written down and lost in time.
2025-02-09 - Wifi APIs on Android 13
Category DEVI’m still in the process of updating RTAC to work properly on Android 13.
RTAC uses a number of APIs which have been deprecated since Android 10. Since it was running on 2017 hardware with Android 9, that wasn’t much of a problem. Now I want to move to newer hardware that runs Android 13 so I need to deal with it.
WifiLock:
- The WifiManager.WifiLock API is still present and usable.
- I’ve added a handler class for it in TCM.
- However it’s not absolutely clear what it really provides.
WifiManager#enableNetwork is reserved to “Device Owners” and system apps.
- It seems that ConnectivityManager#requestNetwork could be an adequate replacement?
- A first try of the ConnectivityManager#requestNetwork API wasn’t conclusive.
- The app suddenly displayed a model dialog “connecting to device” with a spinner, which has the undesirable side-effect of pausing the main TCM activity.
- Configuring the request for a known SSID did… nothing. It stayed on that spinner and did not switch to that wifi network.
- Configuring the request for a known SSID and its WPA password did something weird where the wifi list showed a second entry of the SSID “for this particular app”.
- So far that didn’t work as expected. My goal is to switch the wifi to an already known SSID that has already been configured in the Android wifi setting and already set up with password et al.
To be continued.
2025-02-05 - Here we go again…
Category DEVSomehow the same wishes always circle back:
“Aww, wouldn't it be cool if <insert random unfinished project name> had a built-in editor and I could code the app on my {phone, PDA} whilst I'm using it?”
A few decades ago that's how the Hint project started, which quickly got nowhere -- mostly because I was trying to get everywhere at the same time.
And of course later I realized the goal is its own anti-goal -- it's already hard to finish one project, so adding another project inside that project pretty much guarantees that neither gets anywhere, fast.
2025-01-29 - Moving Again…
Category DEVAnother month, another problem… I’ll spare you 2 days of internal discussion and I’ll just summarize it in one sentence:
I pretty much have decided to move all my open source repositories from BitBucket to GitHub.
Historically I had all my code on Google Code. When that service shut down, a lot of folks went to GitHub and I had my reservations about that service. Instead I chose BitBucket. I still have some philosophical issues with GitHub, but right now I have even more of them with BitBucket so… a lengthy migration is in order.
Recently I’ve started two game projects at home, none of which are in a good enough state to be published. One of them is TD1 which I’ve discussed here in the previous years, and I finally built a prototype, originally to have a concrete way to explore the issues in a specific defense-vs-attack gameplay. There were some interesting challenges. Then I’ve discussed that with some friends. Now that this is done, I have had little motivation to actually implement the discussed gameplay changes. Instead I have thoughts on other projects.
Then I see a lot of little short games on Itch.io that are “playable” -- small scopes and essentially “mostly” finished. But I honestly don’t feel like playing them much besides the initial intro. Each time I think I’m maybe jealous because these games are finished and mine aren’t… but is that really the case?
Well, let’s analyze this a bit more.
1- I’m jealous these games are “finished” and I don’t finish mine.
- Well, it turns out the first part is only the appearance of it. I fully understand some of the games I see in the various itch.io Jams are only finished “on the surface” -- good enough for a Jam deadline. Each time I try some, I feel like there’s a lack of depth.
- It’s not true that I don’t finish my games. My Labs has Nerdkill and Asqare which, also on the surface, can appear “finished” -- and in fact these 2 are actually finished from my point of view.
2- These games lack gameplay depth. Well, yeah. Totally. All of them.
- Nerdkill is a good example as I never intended for the “game” to have a scoring system because then it would become the game I don’t want it to be (gratification of violence). Not having a scoring system is a core part of this gameplay (“violence is pointless”).
- Asqare could do more, but really what for? It’s a me-too kind of gameplay and the more I add to it, the more it would be clear it’s not Bejeweled -- when I started, I was trying to not be that game, as part of the original implementation was to try different gameplays -- but the problem is that no matter what, it would be compared to that baseline.
3- I do have a number of totally unfinished games. Or maybe it’s better to see them as “not even really started”. They are not even on the Labs page or anywhere to be found.
- Cangrejo is one. It’s 200% me-too and not even clearly defined where it was going anyway. Jump! is another one such. They are essentially technological demos with a complete lack of interest in producing even a finished MVP. I only started them because I saw some other game and I thought “hey how would I implement this”. But once I found the core engine implementation, I didn't really care about all the work needed to make it a playable game.
- In a way TD1 falls into that category as well. I had a vague idea, but I see a huge gap between what the prototype is and where I’d want it to be, and it’s not clear to me the end result would be interesting. Thus, yeah, I have little motivation to put in the effort to bridge that gap, only to end up with something I don’t care for at the end.
In essence, that last part is key: I measure the cost of the project in terms of involvement versus result, and I don’t find it motivation compared to other stuff I may be doing. For example stuff like Conductor, RTAC, or even SDB have a high involvement cost, yet on the other hand I can see the tangible benefits to me of having them working -- the Randall Museum visitors may not see the software behind the train automation, yet I know what drives that automation and I’m proud of it.
The other aspect of these game projects is that I tend to focus on the wrong thing. I find it more interesting to focus on the engine and the framework than the gameplay or the rendering itself. I’m not really a game designer, and I’m definitely not a graphic artist. Eventually implementing the gameplay is the least interesting part of game development so far.
2024-12-29 - Kotlin Web
Category DEVIt's time to look again at Kotlin for web development. Last time I tried it, a few years ago, it was embryonic and really not suitable for usage. Since then things have changed.
The entry point is Kotlin Multi Platform. It has now a version of Jetpack Compose: https://www.jetbrains.com/lp/compose-multiplatform/
The goal is to evaluate that against my use of Dart / Flutter on Firebase GCP.
There's currently some uncertainty in the future of Flutter. Dart should survive a bit longer as it still seems to be used internally by core projects, however the same can't be said of Flutter according to the water tank hearsay.
Evaluation criteria:
- How to build a Kotlin MP project.
- What can Compose do for the web.
- Overall app architecture.
- Integration with Firebase authentication.
- Integration with Firebase DB.
- Ecosystem of 3rd party libraries.
- Ease of maintenance over time.
These are all points where Flutter more or less excels. Dart seemed like a barrier at first, until I understood it as basically “Java/Kotlin meets Typescript”. After that, it just made sense and it's easy to work with and pick it up again when I only tweak a project once a year.
The “web UI” aspect of Flutter is familiar -- it's basically ReactJS, but easier to use, and better documented.
The Flutter doc is very strong, and the IJ plugin is a delight to use.
Click here to continue reading...
Time to try again if this combo finally works.
My main motivation is to use C++20 Modules.
(TL;DR Summary: it works… and yet it doesn’t. C++ Modules require a very specific compilation ordering due to cross module dependencies, and the Arduino CLI simply cannot do that. However with ESP-IDF and CMake, it should be fine.)
There are 2 issues, which keep haunting me:
- The “N+1” problem with the first page repeating some but not all of the index.
- Using the “next page” is “page N” and “next page” after that is “N-1” till page 1.
I have reverse ordering. The design is that each blog page has a stable URL with N articles each, so let’s say 10: page 1 is 1..10, page 2 is 11..20, etc. up to page N that “fills” up to N articles so that the last page always has an overlap with the index.
It’s telling that even I get surprised when I click on the “Next Page” link on the index and end up on “Page 6” rather than “Page 1”.
Issue 1: Previous / Next Links
The other issue is the navigation links.
I went from this, which was problematic:
⇐ Previous Posts Next Posts ⇒
to this, which IMHO has other issues:
⇐ Previous Page Next Page ⇒
The problem with “previous/next post” is that it’s ambiguous: “previous” is implied to mean “page N-1” or “older in time”, and “next” would mean “page N+1” or “newer in time”. But because the pages are in reverse chronological order, the “next” link actually points to an older-in-time content and page N-1. That’s the reverse of what one would expect.
I think we can solve that conundrum by renaming the links to be more technically correct:
⇐ Newer Page Older Page ⇒
⇐ Newer Post Older Post ⇒
That’s a small trivial change that I think that would be less ambiguous:
- Newer / Older only imply time-based ordering, not index-based ordering.
- We’re not implied what is a “previous” or a “next page” anymore.
- Navigation is “[page N+1] << Newer || current is page N || Older >> [page N-1]”.
⇒ Done. Implemented. Seems very nice.
Also added an “{{If.IsIndex}}” command in the template so that we can have “Newer Post” in the single blog full page vs “Newer Posts” in the index blog pages. This required adding a crude support for nested {{If}}...{{Endif}}.
Click here to continue reading...
Pi5 uses the latest version of the “Raspberry Pi OS”, which is currently Deban bookworm with a Linux kernel 6.6.51. That breaks some stuff expected by the Piface “pifacedigitalio” library.
The first (unexpected) change is that we can’t use PIP to install packages in the system-wide Python provided by the Debian install. Instead a virtual env is enforced to ensure such packages do not break the entire system.
There is apparently a flag “pip --break-system-packages” that works around that check, and interestingly that option is not in the man page.
For a quick test, there’s some value in using a virtual env folder that I’m going to trash later.
The next realization is that none of the stuff works anymore:
Error “No such file or directory: '/sys/class/gpio/gpio25/value”
On an RPi 1, that means the user is not part of the group “gpio”.
Here it is apparently due to the fact that the GPIO driver has been changed and the “sysfs” paths are no longer valid. Fun. The core issue seems to be with GPIO interrupts here: https://github.com/piface/pifacecommon/blob/master/pifacecommon/interrupts.py
This describes the (now deprecated) sysfs interface: https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
Translating these:
- The old way was to “echo 25 > /sys/class/gpio/export”
- That would make create/expose “/sys/class/gpio/gpio25/” at which points the pseudo files for direction etc could be used.
However:
- Instead now we have /sys/class/gpio/gpiochip512/base (512) + /sys/class/gpio/gpiochip512/ngpio (58) which means this controller handles gpio’s in the range 512..up to 570 excluded. Then there’s “gpiochip570” which has base=570 and ngpio=8.
- “$ gpioinfo | grep 25” ⇒ this lists all the pins and we can find that “GPIO25” is actually #25 (from 0-base) on that gpiochip0 which is actually the giochip512 above.
- 512 + 25 = 537… so that’s the new “sysfs” number for GPIO25.
- $ echo 537 | sudo tee /sys/class/gpio/export
- ⇒ And that makes “/sys/class/gpio/gpio537/” appear.
Click here to continue reading...
https://play.google.com/store/apps/details?id=net.christianbeier.droidvnc_ng
and
https://github.com/bk138/droidVNC-NG
There are 2 things that interest me here:
- This app auto-starts using the Accessibility API. I want to understand that API so that I can use it in TCM, since Android 14 does not support the old “Boot Receiver” method.
- What are the steps needed to embed a VNC server in an app?
- A use case would be TCM sharing its own view, without access to the entire tablet. Is it worth it to even consider that, or just install DroidVNC-NG on the side?
Accessibility Service API
https://developer.android.com/guide/topics/ui/accessibility/service
What it is:
- Android 8 (API 26) and above.
- A service, declared in the manifest.
- It can listen to events, and inspect the view hierarchy.
- “Explore by Touch”: respond to gestures by interacting with screen elements.
- AccessibilityService#performGlobalAction to perform an action.
- AccessibilityService#getSystemActions to figure available actions.
It doesn’t seem like an AccessibilityService could start an app directly per se.
However it could potentially use GLOBAL_ACTION_HOME to invoke the Home app, then explore the hierarchy and click on the relevant app icon to trigger it. It’s not clear whether the service can do that on its own; it’s likely it needs to respond to a user gesture first.
ACTION_BOOT_COMPLETED and RECEIVE_BOOT_COMPLETED
Click here to continue reading...
2024-08-04 - Kotlin KMP
Category DEVhttps://kotlinlang.org/docs/multiplatform.html
Evaluate this against my needs:
- Android development
- Web development
- Existing libraries
Rationale: KMP is all about the “multiplatform” aspect. I have zero multiplatform projects.
Android development: I don't do Android/iOS parity, so is there a point over Android Kotlin native? I doubt so.
Web development: This is competing with Flutter. I'm fine with Dart and Flutter. It beats anything React, whilst being mostly the same design. There are good libraries to interact with GCloud, Firebase, and it's been easy to find 3rd party libraries when needed.
Framework updates are the only thing tedious.
Before starting the Flutter way, I remember trying “Kotlin for the web” and that was not good. Was it KMP? Worth another look. Criterias are IDE support, Firebase integration support, framework updates, distrib size.