17
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?
Last week I got annoyed when writing text on "virtual keyboards". I decided to make a proof of concept for a binary search text input mechanism. https://apos.itch.io/binaryinput
I streamed my whole creation process here: https://youtu.be/6YO2cDFNMEk
I really like the result. I think with a bit more work, it could be quite a lot better but for now I consider the proof of concept a success.
Edit: Updated the colors: https://video.twimg.com/tweet_video/EPygQpRXsAMlFw-.mp4
I think that with blue for left and red for right, it's even easier to pinpoint a letter even without looking at the cursor.
Dude what. This makes so much sense. Perfect for TV remotes and gamepads. Did you come up with this concept?
Yeah, came up with it last week (or the week before?). It's based on the guess the number game that you do in computer science courses. I talked about it to other people. One point that came out was that it might be hard to train people to use that. I made a few people try it, but it seems like it doesn't take too long to figure out for them. (I didn't use any weird things like double clicks or long presses so that helps.)
Another issue was how to recover after an input error. But I put a mechanic to break out of every combo. That makes it feel very responsive. (Also feels so much better than having to fix a mistake on something like the Apple TV.)
Next steps would be to add more characters, and perhaps predictive word suggestions.
Something cool to try would be a password mode. I think people could easily write their passwords without seeing the cursor. That would let you connect to an account even in a room full of people.
Of note is another invention I've seen online, though I can't find the link. It was an app that would order the keyboard to issue different symbols based on whether a particular key – CapsLock – was pressed. It did so in order to enable typing on the desktop keyboard with one hand: pressing CapsLock would mirror the keyboard's farther part, as if it was folded against each other. Pressing Q while holding CapsLock would produce P, pressing A would presumably produce L etc.
This is so cool! I'm surprised it's not more common.
Now that you remind me of it...
You know how there are two-part keyboards you can buy? The ones you have to hook up and can move separately? Get one, add the Mirror button, sell as the next big thing in consumer peripherals.
Because frankly, I think the issue is not that the mirrored layout is inefficient: I think it just hasn't been properly field-tested and marketed.
That looks awesome! Years ago, I found dasher, an on-screen keyboard that has a similar concept.
Here's a video of it in action.
Wow, that's really innovative! Though I find it makes me dizzy.
It's a brilliant concept. I want to see where you go with this.
Okay, this is great, but I'm wondering how this is going to get distributed [soon] to the proprietary devices and systems where it's needed most.
I'm not sure yet. I don't have many contacts.
I have a personal website that I used to generate locally using gulp.js, but since I barely know Javascript this was always a challenge. So when I recently wanted to update my website, I decided to first...create a Gulp replacement in Python so I could at least understand my build tool better.
Now I've got a working first draft of Hiccup, and I've migrated my personal site from Gulp fairly easily. My website looks basically unchanged here, and the git repo is here. All the magic happens in hiccup_config.py, which is almost the exact same length as my old
gulpfile.js
but much easier for me to edit when necessary...because I'm much more fluent in Python.Oh, and now I get to write pages in markdown files with yaml frontmatter that get rendered with jinja templates—that part's all new.
I haven't written any docs or tests yet (it's brand new!) but I'm hoping to get it to a state where someone else could reasonably pick it up and use it.
I'm not sure exactly what you're looking for, but there might be some useful libraries built into Python inside these sections of the standard library: https://docs.python.org/3/library/datatypes.html
For example, some of the classes in the
collections
library help with a lot of tasks, and other ones likeheapq
orbisect
could have useful applications too.There's a lot of interesting stuff in the
itertools
library as well, but it will really depend if it's applicable to the particular problem: https://docs.python.org/3/library/itertools.htmlOne other place that might be good to look at is Rosetta Code, where there are a lot of pages showing how to implement some common structures/algorithms in different languages. For example, here's the section for tree traversal in Python: https://rosettacode.org/wiki/Tree_traversal#Python
Did you do the test yet? How did it go?
Me and a colleague have set out to write a simple, unsampled metrics library in Erlang called seer. There's not much there, but it isn't missing that much, either.
Aside from that, I finally published by Hashicorp Vault client (also written in Erlang) at https://hex.pm/packages/canal.
I gave contributing to a C++ project a try. SCJingleConverter, it's a part of the OpenSteamController project. SCJingleConverter reads in .musicxml and uploads Steam Controller-format tune data. Problem is that MusicXML is sheet music split into nice, even measures with notes, ties, and rests of all different shapes and sizes. The Steam Controller expects just a list of events of frequencies and durations.
The way SCJingleConverter used to do it was create an event for each note, even if that note was tied or that note was one of 5 consecutive rests or maybe even a trailing or leading silence. With only 1024 bytes to work with and each note costing 6 bytes, that ended up being an issue.
Never worked with C++ in my life before (man that's a lot of weird syntax I haven't seen in any other C-like language) but I managed to bash my head against the wall til it compiled and worked properly.
I've been working on taking full advantage my ISP's new fibre-to-the-home internet (1.5Gbps down / 1.0Gbps up). Since my house is wired in CAT5 most of my hardware will be limited to gigabit speeds, but since the fibre comes in next to my servers I have some opportunity to play around a bit.
The first challenge was bypassing the ISP router hardware. My ISP negotiates the connection with PPPoE. One nice feature of their box is that it forwards PPPoE requests, so I can establish the session on my own router (pfSense box). While I waited for my fibre hardware to ship, I disabled all the wireless features on the ISP provided router and did just that, with a single link.
Once I got a few eBay special dual port 10G PCIe SFP+ NICs, I had to use eDiag to reconfigure one of the ports on the NIC in my router to support negotiating to 2.5G (almost every card only allows 1G or 10G by default). For some reason, my ISP programmed their GBICs to negotiate at 2.5G. Sure, they would need to be at least that fast to offer my package, but it's a weird choice. The only off the shelf hardware that I am aware of that supports that speed is an $800 Ubiquiti switch, which is a bit much for me. Thankfully the flashing procedure was just a simple UEFI program that wasn't too hard to get my hands on. It's absolutely wonderful to not have the massive backdoor to my network sitting on my shelf anymore (though I suppose they could have a backdoor on the SFP).
Now of course the pfSense drivers for my NIC don't support 2.5G negotiation either, so that meant compiling a new kernel module with a convenient patch from a DSLReports user. The patch was small and easy to understand, and probably free of obvious backdoors. There was a pre-built binary available, but I felt it was best to build it myself since I went through the trouble of skimming through the patch anyway. I first tried to build it in a FreeBSD VM that was newer than my version of pfSense, which did not work at all, even though I was using the correct sources (I still find this confusing). Switching to the same version of FreeBSD as my pfSense installation worked. I'll need to repeat this process in the future if I want to upgrade, which bugs me a bit. Hopefully the drivers don't change much and the patch still works.
And that was pretty much it for the WAN side of things. I left the interface on auto-negotiate mode and it went to 2500Mbps without any fuss. If my ISP ever offers new plans on a 10Gbit GBIC the NIC will support it too.
Then I configured the rest of my network. I used two bridged 1GbE copper ports to feed two unmanaged switches that lead to different devices on my network. I was careful to ensure that my two wireless APs were on different switches so that they could potentially max out my connection. I'm still waiting on a bit more hardware to ship so that I can get a full 10G network between my storage and compute servers. I don't have a switch that supports LACP (yet). I have a spare 2x10G SFP+ card that I can pop in the router itself, so I can just connect my two servers to it directly.
This may seem a bit trivial to any networking gurus out there, but it was fun and involved a bit of troubleshooting along the way.
Fun bonus: Bell Canada lets me open multiple PPPoE sessions so I can assign a bunch of different public IPs to services on my network.
Not so fun: no IPv6 support (boooo).
I am having a bit of trouble with this one feature of one of the apps we're building: dynamic, user-specified form generation! It's a bit of a complicated thing to explain, but effectively I have a JSON blob representing the schema for a form for a particular entity in my database, like so:
And there can be lots of these entities—that's a very simplified example. It's not a situation where I could hand-build a bespoke form fragment for each one. I have to take this—what is effectively a DSL—and build a dynamic form in Angular out of it. To make it worse, it's potentially recursive in nature, so I have to deal with trees and nesting. This is a bit of a problem I have to suss out because fundamentally it's a template generation problem compounded by being a UI/display problem, and Angular historically doesn't have very good support for dynamic HTML generation (there are things like
ComponentFactoryResolver
that can help).I probably won't flesh out a fully dynamic solution initially and just support the bare minimum in terms of features (no validation rules, no fancy UI declaration). But it's not a fun problem for me to work on.
Hmm, that sounds like it could be tricky. Where does that JSON come from? Did you create an interface where they specify the fields, or is it from some other source?
JSON is just my own internal representation of the data we need to collect as part of a form. Stored in a
jsonb
column in the appropriate table of my postgres DB and then outputted via an API endpoint. The JSON is created by myself to represent the data we need to ingest; for example a drivers license would have a whole array of fields present. It's not programmatically generated or anything.As for the actual representation as a schema, I don't like it, because I feel like it requires combined knowledge from the client and server, but the "type" property defines what client side component should be displayed (so
textarea
would map toAppTextareaComponent
, etc), and the key defines the name of the form control in the client.It looks like the Angular support for dynamic component templating has improved a bit since I last visited this topic, it's possible to do things like this now:
This gets me half of the way there, and with a few alterations could be made to support nested fields. Unfortunately, a lot of the API is still pretty poorly typed.
Hmm, I've never done anything significant with Angular, so this is really just idle speculation that may not work at all with your app, but could you just generate the HTML as a string at the same time you're generating the JSON, and use that directly, or does it need to all be done through the components?
For example, your example JSON seems to translate pretty directly to:
Unfortunately we need the whole data-binding pizazz and dynamic component declaration that Angular provides. A lot of these forms are quite complex in nature—lots of data gathering for Health & Safety purposes—so static server side HTML would be a simple solution but not enough for our needs.
You can use Angular form builder to build reactive forms dynamically from the JSON representations. This might help: https://angular.io/guide/dynamic-form
Bit more complicated than this (we've created our own set of components for each control which also need to be dynamically generated), but yeah, this is what we're going for. I vaguely remember seeing this page before, actually. Cheers!
Ooh. Digging the aesthetic! What kind of game is this planned to be?
I've installed and configured Void Linux...again. Something got screwy with my first install after I had spent some time getting a pretty decent setup going. For some reason I wasn't allowed to login even though my password as definitely entered correctly... Kinda discouraged me and I neglected the laptop for a couple of months.
Anyway, currently using the the musl variant. Using sway as my window manager, kitty as my terminal emulator, and Elvish as my shell. Kakoune is my text editor, though I'll probably switch to micro once the next version is released, which should fix a bug preventing me from using it in kitty. Well, I'll probably use both. Though Kakoune will take some practice to get productive in. Oh, and I started using exa in place of
ls
. I'm trying to keep this as terminal-focused as possible so that I'm forced to get used to working in a terminal. Figure it'd be good for me.I'm still coming to terms with the internals of a Linux system, so futzing with config files and shell scripts and figuring out where to place environment variables and stuff is making the setup process somewhat slow, but I hope to learn something from it.
Once I've got the desktop configured to my liking I'll go ahead and try to get a development environment going. Though... I'm afraid of breaking things.
If anyone has some tips, tricks, or advice I'm all ears.
I'm been working on a program written in Python for creating polls using alternative voting methods. The polls are meant to be accessed in a website served over the local network. It's in a early stage at the moment, though I hope to get the basic version out in a week or two.
Toon, I'm also interested in this. Do you have a git hub page? Is this an open source project?
https://github.com/johnh865/election_sim
It's meant to be open source, though I haven't gotten around to publishing it on GitHub yet. I'll post it on the latest version of this thread once I get it up.
This week I worked on a simple url shortener - Cortris. It is written in Go & uses sqlite to store shortened urls.