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?

36 comments

  1. [11]
    Apos
    (edited )
    Link
    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...

    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.

    25 votes
    1. [5]
      TurdFerguson
      Link Parent
      Dude what. This makes so much sense. Perfect for TV remotes and gamepads. Did you come up with this concept?

      Dude what. This makes so much sense. Perfect for TV remotes and gamepads. Did you come up with this concept?

      2 votes
      1. [4]
        Apos
        (edited )
        Link Parent
        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...

        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.

        2 votes
        1. [3]
          ThatFanficGuy
          Link Parent
          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 –...

          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.

          1 vote
          1. [2]
            Apos
            Link Parent
            This is so cool! I'm surprised it's not more common.

            This is so cool! I'm surprised it's not more common.

            1. ThatFanficGuy
              Link Parent
              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...

              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.

              1 vote
    2. [2]
      zlsa
      Link Parent
      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.

      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.

      2 votes
      1. Apos
        Link Parent
        Wow, that's really innovative! Though I find it makes me dizzy.

        Wow, that's really innovative! Though I find it makes me dizzy.

        1 vote
    3. ThatFanficGuy
      Link Parent
      It's a brilliant concept. I want to see where you go with this.

      It's a brilliant concept. I want to see where you go with this.

      1 vote
    4. [2]
      Pistos
      Link Parent
      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.

      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.

      1 vote
      1. Apos
        Link Parent
        I'm not sure yet. I don't have many contacts.

        I'm not sure yet. I don't have many contacts.

  2. daturkel
    Link
    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...

    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.

    3 votes
  3. [5]
    vivaria
    Link
    I made a post a week or two ago about preparing for an interview for a job in Montreal. The interview went really well! Today, they sent me a HackerRank test, which seems... promising? Normally I...

    I made a post a week or two ago about preparing for an interview for a job in Montreal. The interview went really well! Today, they sent me a HackerRank test, which seems... promising? Normally I receive those prior to the interview, but this is the first time I've received one after the interview. Glad to see the communication flowing rather than a rejection letter, so, hoping for the best?

    The HR tests I've gotten previously have varied quite a lot? I've had <60m ones that were easy as heck and didn't require any sort of concern about time complexity. My guess is they were screening for how well you can utilize the basic functionality of your language of choice. But, then I've had >90m ones that really squeezed you for your ability to map a problem to a certain algorithm/data structure. I've uh... never taken any DS/ALG courses, so I've bombed those tests.

    All I know about this Montreal HR test is that it's only 40m long. Since I don't have any indication for what kind of questions will be asked, I'm just uh... diving straight into DS/ALG theory to try and glean what I can before taking the test. I really want this job so I want to be as well prepared as possible for whatever might come up.

    Still though, I'm not very familiar with the capabilities of Python for things like graphs and trees. I'm trying to get a sense of what's built-in and what I'd have to build from scratch. I don't know how much I'll be able to cram into my head before I take it. The worst part is, there were no instructions in the email for when I should complete it by, so I'm not sure how much time I should spend preparing. Will the other applicants submit theirs before me, and will it look bad that I waited a few days before completing it? I have no idea.

    If anyone has any resources specifically for wielding Python to solve these sorts of problems, I'd love to hear.

    3 votes
    1. [2]
      Deimos
      Link Parent
      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:...

      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 like heapq or bisect 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.html

      One 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

      1 vote
      1. vivaria
        Link Parent
        Now that I've taken a look at the HackerRank "Interview Prep" questions, there seems to be a bias towards simpler data structures and searching/sorting (they give stats for X% companies ask these...

        Now that I've taken a look at the HackerRank "Interview Prep" questions, there seems to be a bias towards simpler data structures and searching/sorting (they give stats for X% companies ask these questions). e.g. I'm seeing a lot more of "apply a dictionary in a creative way to reduce time complexity"-esque questions rather than questions about graphs/trees/recursion. (But I'll keep your links in mind as I get to the more rarely-asked questions, so thank you!)

        After doing a few medium-ish difficulty questions, I'm really starting to understand why the resources I've come across say to have hashmaps at the forefront of your thoughts when approaching a question. They're helpful!

        1 vote
    2. [2]
      Apos
      Link Parent
      Did you do the test yet? How did it go?

      Did you do the test yet? How did it go?

      1 vote
      1. vivaria
        Link Parent
        Thank you so much for checking in!! I did the test, and it turned out to have only very basic programming questions. I was able to get 100% fairly easily, although I did get flustered because of...

        Thank you so much for checking in!!

        I did the test, and it turned out to have only very basic programming questions. I was able to get 100% fairly easily, although I did get flustered because of the time pressure. There were some reservations I had about the way in which I came to my approaches, and the quality of my solutions, so I initially felt quite negative. I was worried my anxiety stifled my ability to demonstrate my skills? But, after a day I felt positive and hopeful about my chances.

        I received a quick follow-up from the HR team with my results and a note that I would be contacted shortly. Then... they ghosted me? Perhaps I haven't given them enough time, but they've been entirely unresponsive to my emails despite explicitly saying they would get back to me. Which is really unfortunate, because I had gotten another offer last Friday, so I was put into a pretty awkward place.

        Today was the day where I decided I wouldn't try to stall anymore, so I accepted the other offer. I'm... going to Thailand for 4 months instead of Montreal! I feel very good about this path too... I'm going to graduate, and end with some quality industry experience, I think! I should be set for when I begin applying for full-time work come September. :) :)

        2 votes
  4. rkallos
    Link
    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...

    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.

    3 votes
  5. Diff
    (edited )
    Link
    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....

    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.

    3 votes
  6. [2]
    jcdl
    Link
    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...

    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.

    3 votes
    1. jcdl
      Link Parent
      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).

      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).

      1 vote
  7. [7]
    emdash
    Link
    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...

    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:

    {"medications": {"type": "textarea", "required": true}}
    

    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.

    2 votes
    1. [4]
      Deimos
      Link Parent
      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?

      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?

      1 vote
      1. [3]
        emdash
        Link Parent
        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...

        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 to AppTextareaComponent, 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:

          constructor(private componentFactoryResolver: ComponentFactoryResolver) { }
        
          public ngOnInit(): void {
            this.generateFormConfiguration();
          }
        
          public generateFormConfiguration(): void {
            Object.entries(this.dataShare.userData.dataCategory.fields).forEach(([key, value]) => {
              this.components.push(this.loadComponent(key, value));
            });
          }
        
          public loadComponent(key: string, field: IDataCategoryField): ComponentRef<unknown> {
            const componentToMake = this.componentMapping.get(field.type);
            const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentToMake);
            return this.host.viewContainerRef.createComponent(componentFactory);
          }
        

        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.

        1 vote
        1. [2]
          Deimos
          Link Parent
          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...

          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:

          <textarea name="medications" required></textarea>
          
          1 vote
          1. emdash
            Link Parent
            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 &...

            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.

            1 vote
    2. [2]
      szferi
      Link Parent
      You can use Angular form builder to build reactive forms dynamically from the JSON representations. This might help: https://angular.io/guide/dynamic-form

      You can use Angular form builder to build reactive forms dynamically from the JSON representations. This might help: https://angular.io/guide/dynamic-form

      1 vote
      1. emdash
        Link Parent
        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...

        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!

        2 votes
  8. [3]
    ovo
    Link
    I made the exterior of a house for my game (preview & preview). Unfortunately the sides aren't visible in game (video). As for my codes, I decided to split it in multiple files after adding more...

    I made the exterior of a house for my game (preview & preview). Unfortunately the sides aren't visible in game (video).

    As for my codes, I decided to split it in multiple files after adding more than 100 lines in a single script. I'm not familiar with Godot, I conclude that I should emit signals with the children and only the parent should listen. I wonder if it's good rule for having an organized project.

    2 votes
    1. [2]
      krg
      Link Parent
      Ooh. Digging the aesthetic! What kind of game is this planned to be?

      Ooh. Digging the aesthetic! What kind of game is this planned to be?

      3 votes
      1. ovo
        Link Parent
        Thank you. I did this in vertex color, so without any texture at all. I plan to make a rogue-lite game like Pokémon Mystery Dungeon but with generated maps that can revisited. The player has a...

        Thank you. I did this in vertex color, so without any texture at all. I plan to make a rogue-lite game like Pokémon Mystery Dungeon but with generated maps that can revisited. The player has a team of creatures for fighting, like Pokémon Red. The player can also fight but he's weaker and the game is definitely over If he's defeated. I consider this project to be over-ambitious to be playable soon but I like learning various things in the process.

        4 votes
  9. krg
    Link
    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...

    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.

    2 votes
  10. [3]
    The-Toon
    Link
    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...

    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.

    2 votes
    1. [2]
      johnh865
      Link Parent
      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

      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

      1. The-Toon
        Link Parent
        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.

        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.

  11. adalricus
    Link
    This week I worked on a simple url shortener - Cortris. It is written in Go & uses sqlite to store shortened urls.

    This week I worked on a simple url shortener - Cortris. It is written in Go & uses sqlite to store shortened urls.

    2 votes