13
votes
What programming/technical projects have you been working on?
This is a recurring post to discuss programming or other technical projects that we've been working on. Tell us about one of your recent projects, either at work or personal projects. What's interesting about it? Are you having trouble with anything?
Foot Pedal
(This is more a basic electronics project than a software development one)
Problem
I'd been thinking about getting a foot pedal to use with my PC for a couple months, but I wasn't particularly enthused by the selection I saw for purchase:
Requirements
Plan
My idea was to approach this like building a mechanical keyboard:
This approach reduces the hard part of the project to "How do I connect a pedal to a mechanical keyboard?". My insight was that pedals for digital pianos and mechanical keyboard switches work exactly the same way: it's a basic electrical switch. So I just needed to get a keyboard switch, remove the stem and the spring, and then solder a connection from the metal leaf inside the switch to a female TS jack . This would give me a "Keyboard Switch to Female TS Jack" connector that lets me connect any digital piano pedal to any mechanical keyboard.
I expected the solder joint to be a weak point, so I hoped that filling the keyboard switch with epoxy afterwards would reinforce the solder joint.
Materials
Epoxy(Never ended up using)Challenges
Improvements for next time
Miscellaneous Notes
This sounds cool. As an enthusiast of cursed, hacked-together input devices, I approve.
Heat shrink, by the way, is not really intended to hold things together. It's to cover joints that are already soldered or crimped.
If you're not already, I'd also recommend trying a leaded solder (63/37 is nice to work with). Lead-free solder is harder to melt.
Congrats! For the soldering iron, I can highly recommend the pinecil. It gives you so many features for the price. Only drawback is it took me a long time to get mine, but they may have fixed their supply chain since then.
I've been working on a set of related websites, each deployed using Astro for static site generation and deployed with Cloudflare pages. There was a rush to set each of them up, so right now I have three separate git repositories with slightly different versions of the Astro template customization / basic components because I've been refining them as I go.
I want to set up a monorepo with a separate package for the components and a package for each website deployment. That way I can have a common template and keep the look and feel in sync between them.
I was able to make this example work, but no matter what I do, I can't get the intellisense in vscode to resolve the imports from the other package. Not the end of the world, but pretty annoying.
When I started porting my own code into the monorepo structure, I broke something else so I get some kind of error about not having a rendered for the type.
I'm pretty sure this is the "right" way to do it, but it has been super frustrating to try to set up. I'm on the verge of just putting the common components into one of the sites and symlinking the directories into the other folders. I'd have to test that that works in the Cloudflare deploy, and it feels barbaric, but I'm almost at my wit's end.
If anyone has any insights or suggestions to share, I'm open to suggestions. I'm fairly new to Typescript and JavaScript, so maybe I am missing something.
I’ve done this so many times, and it’s always a little painful. Is this a public repo? Or, would you feel comfortable adding me to the repo if it’s private? Happy to take a look, I’m sure we can figure it out!
Thanks, I will put something up tonight or tomorrow and DM you.
Sounds good!
Thanks to @smores generous offer, I was transferring my (anonymized) code to a public repo and found the issue along the way. Code is here for anyone who is interested
Because I hate it when people don't post their solutions, here's what happened:
Problem 1: VS Code Intellisense couldn't see the common package because Yarn uses symlinks inside of
node_modules
. The build environment is dockerized, but I was running VS code outside of WSL in my Windows environment. That's the lazy default, but usually VScode is pretty good at handling that. When I connected the VS Code environment to WSL, then it resolved the common package and I got a much more useful error message.Problem 2: Even if the Intellisense was not working, Astro should have been able to run/build the site, but I was getting this error from Astro when doing
yarn run dev
:With Intellisense working, I got a much more useful error inside the
index.astro
page:Module '"/path/to/multi-astro/sites/multi-astro-common/index"' has no default export. Did you mean to use 'import { Card } from "/path/to/multi-astro/sites/multi-astro-common/index"' instead?
So of course, changing the line from
to
fixed the problem. It seems like a stupid thing to spend so much time on, but one of my takeaways is that being in a fully Linux dev environment is generally a better way to start. The DevContainer VS Code tools make this pretty easy even on a Windows machine.
@smores, thank you again. Here is your honorary Duck Badge:
I've been reading a lot about LTO archival. So far I've learned that:
I only have a couple hundred TBs and I'm pretty content now--I'm not looking to extend into the >600 TB range right now so my conclusion is that a tape drive probably doesn't make sense for me right now. But if someone wants to pay me to sign up to USENET and just download stuff then I would invest in a tape library first.
Other than that I've been researching parallel/cluster compute platforms like HTCondor, Nomad, Triton DataCenter, and other tools listed here: https://github.com/dstdev/awesome-hpc. This week I've started writing something lightweight for spinning up systemd services across PCs (a bit like telefork, Outrun, or Exodus) taking into account (simple polling) resource allocations like %iowait, cpu_idle, available memory and excess network capacity.
After a few weeks at my new workplace I'm beginning to understand the code I work with more and more. The longer it goes on the more I appreciate the importance of good code design. Coming from physics well, most code written there is uhrm... Suboptimal. My own code back then included.
I've also been appreciating C# a lot. It's pretty powerful and easy to read.
All in all, I've written very little but have been understanding the code more. It's a strange feeling where, the less you have to show you sometimes have actually achieved more.
Yeah i used to do electrical engineering and it was a shock getting into that from a comp sci degree and then another shock 5 years later when i got back into a more traditional comp sci role. C# is fun and a widely transferrable skill, congrats on the new job.
This week on repeatTest, I finished up the work I was doing on tables. A table is an array type that’s restricted to storing objects (also called rows), and can restrict some of the row properties to be unique keys. Up until now, rows could only have a single shape, but I added support for having multiple shapes by making the row a tagged union. The property for a unique key needs to be defined the same way in each shape.
You can see them in use in this schema, where each node has a name property, and the names need to be unique.
Still need to do a release.
I've been experimenting with smart-home setups these past couple of month- we have a range of Ikea Zigbee compatible bulbs and remotes, a Raspberry Pi 5 with Sonoff Zigbee controller, and a number of other Sonoff smart sensors and such that we're trying out. The majority of the Zigbee communication is being bridged to the controller through Zigbee2MQTT, which has been almost flawless so far. Apart from a few issues when it comes to binding remotes that like to enter deep-sleep modes, the bridge has worked very well, it's HomeAssistant where the problems lie. It never keeps sync with the network state, it's overly convoluted and for all of the extra nonsense it has, the configurability is still poor. It doesn't help that Zigbee devices often have limitations when it comes to modifying parameters (brightness, colour temperature) when they're toggled off (but still powered!).
As a result, I'm writing my own Python-based automation system, with minimal dependencies, and I'm really enjoying it a lot more than I ever did HomeAssistant. I'm enjoying the simplicity of it. It's called "hab", and it mostly handles customisable bindings for switches, sensors, remotes, and lights- with more conditionals. The flexibility of the resulting system should be much better than that of purely using native Zigbee bindings, without being a behemoth of unnecessary code. The big problem that I am trying to solve is in sunrise / sunset re-configuring of lights and scenes. The solution appears to be to write automations which only change the parameters of devices which are currently toggled on, then catch any future remote / switch actions and adjust the target device / scene as necessary. With the use of smart switches like the Sonoff ZBMINIR2, the system will still be able to fail-dumb if the controller is ever knocked out, which is quite important to me.
this doesn't count, but I need to barf it up somewhere.
Last year a Windows 11 update broke my bluetooth. Existing devices were fine, but I couldn't add new ones. I don't use bluetooth for a lot of things, but its nice for headphones.
Anyway, the logs said 'The mutual authentication between the local Bluetooth adapter and a device with Bluetooth adapter address failed.'
For each of the services, you need to change the Log On to Local Service with no password. fixed.