8 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?

22 comments

  1. [2]
    ducc
    Link
    With all the extra time I've had due to the current situation, I've been working on my 8-bit breadboard CPU. I've been following Ben Eater's tutorials on YouTube, and it's a really neat way to...

    With all the extra time I've had due to the current situation, I've been working on my 8-bit breadboard CPU. I've been following Ben Eater's tutorials on YouTube, and it's a really neat way to learn the basics of how computers work at a low level.

    7 votes
    1. joplin
      Link Parent
      I helped write a C64 emulator and that involved learning a lot about the hardware, too. Part of me thinks, "Man they did so much with so little," and another part of me thinks, "What a #$%@ mess...

      I helped write a C64 emulator and that involved learning a lot about the hardware, too. Part of me thinks, "Man they did so much with so little," and another part of me thinks, "What a #$%@ mess these machines were with no protected memory, and everything stomping on each other! And no headers with nicely named constants defined to tell you where everything lived!" No wonder I had such a hard time learning this stuff as a kid. It was crazy!

      3 votes
  2. [3]
    dblohm7
    Link
    Multiprocess GeckoView. Firefox Preview for Android (aka "Fenix") loads all of its tabs into a single content process. I'm working on making that work for process-per-tab and beyond.

    Multiprocess GeckoView. Firefox Preview for Android (aka "Fenix") loads all of its tabs into a single content process. I'm working on making that work for process-per-tab and beyond.

    6 votes
    1. [2]
      wirelyre
      Link Parent
      That's really cool. What's beyond?

      That's really cool. What's beyond?

      3 votes
      1. dblohm7
        Link Parent
        Site isolation (aka process-per-origin) and proper sandboxing.

        Site isolation (aka process-per-origin) and proper sandboxing.

        4 votes
  3. admicos
    Link
    I wanted to start making a simple game. So, like everyone else would, I started with a custom archive format to store all the in-game assets in. It's been a day (and a bit), and I still haven't...

    I wanted to start making a simple game. So, like everyone else would, I started with a custom archive format to store all the in-game assets in.

    It's been a day (and a bit), and I still haven't touched any actual game code whatsoever :p

    The format is so simple, I'm pretty sure someone can create a tool working with it just with the following definition:

    [u32; file count]
    
    for all files:
        [u32; file start location (excl. header size)]
        [u32; file size]
        [utf8; null-terminated; file name]
    
    -- end header --
    
    [raw; file contents of first file]
    [raw; file contents of second file]
    etc...
    
    -- end archive --
    
    And wrap it all with your compression algorithm of choice. Mine is currently zstd.
    
    6 votes
  4. [4]
    pseudolobster
    (edited )
    Link
    Apparently I'm trying to get my laptop's GPU to work. I tried joining the tildes Folding@Home group, but fahclient refused to process anything. Looking it up it appears it needs OpenCL working. So...

    Apparently I'm trying to get my laptop's GPU to work. I tried joining the tildes Folding@Home group, but fahclient refused to process anything. Looking it up it appears it needs OpenCL working. So I guess it needs a GPU. No problem I'll just need to reboot because Pop_OS can't switch graphics on the fly because it's a terrible operating system. Switch to hybrid graphics, reboot, still says intel graphics. That's not good. apt remove all nvidia drivers, reinstall them. No change. Try ubuntu-drivers, says no devices found. lspci says my video card doesn't exist. "dmesg|grep NV" says it's finding my video card's HDMI sound card, but not the GPU itself. Okay well that's pretty confusing. Checked udev rules, initramfs and a few other things to see if there's a blacklist, nope. Found /var/log/gpu-manager.log, which says "Is nvidia kernel module available? no" and "Desktop system detected or laptop with open drivers Nothing to do", spent 20 minutes reading completely unrelated forum posts. I've rebooted a dozen times and I'm still no closer to figuring this out. Now my touchpad has stopped working.

    This is quickly becoming one of those rabbit holes. I'm once again asking myself why I use linux in the first place.

    edit: okay so I'm using systemd-boot, but why do I have a /boot/grub folder? Why does /proc/cmdline match neither? where is it even getting this? how did this even happen in the first place? this was all working last time, and the only thing I've done since then is normal updates. why is the opposite of modeset=1 "nomodeset"? Computers are terrible devices, and nobody should use them. I'm going to live on a mountain and raise goats instead.

    4 votes
    1. [3]
      cfabbro
      (edited )
      Link Parent
      AMD GPU? This advice from @arghdos may help you out: https://tild.es/mq1#comment-4r33

      AMD GPU? This advice from @arghdos may help you out:
      https://tild.es/mq1#comment-4r33

      4 votes
      1. [2]
        pseudolobster
        Link Parent
        Nvidia, but that could still be helpful. Thanks for the link! The problem is my system isn't seeing my GPU at all. It's not loading a driver for it, because it doesn't see the PCI device. lspci...

        Nvidia, but that could still be helpful. Thanks for the link!

        The problem is my system isn't seeing my GPU at all. It's not loading a driver for it, because it doesn't see the PCI device.

        lspci should show something like 01:00.0 VGA Controller: Nvidia Quadro Something Something but that line is entirely missing.

        I'm 100% certain if I booted into windows and installed F@H it would work perfectly. There's just something screwy with my kernel/initramfs config on linux, which I've lost the will to fix for the time being. I think I'm going to make lunch and debate whether or not to just nuke this install from orbit.

        3 votes
        1. cfabbro
          Link Parent
          Ah, I somehow missed that in your last comment. Ooops. Either way, good luck getting it working... or nuking it from orbit. :P

          apt remove all nvidia drivers

          Ah, I somehow missed that in your last comment. Ooops. Either way, good luck getting it working... or nuking it from orbit. :P

          2 votes
  5. acdw
    Link
    Working on my small SSG for my site. It's going quite well, actually: https://git.sr.ht/~acdw/acdw.net I realized that I didn't need to totally reinvent the wheel from my earlier project, so I'm...

    Working on my small SSG for my site. It's going quite well, actually: https://git.sr.ht/~acdw/acdw.net

    I realized that I didn't need to totally reinvent the wheel from my earlier project, so I'm just iterating from that. I feel like I'm actually building something, which is cool!

    3 votes
  6. [2]
    DanBC
    Link
    I have just bought a NodeMCU/ESP8266 board, along with a bread board and some LEDs and jumper wire. I want to try to get my head around it before I give it to my child.

    I have just bought a NodeMCU/ESP8266 board, along with a bread board and some LEDs and jumper wire. I want to try to get my head around it before I give it to my child.

    3 votes
    1. pseudolobster
      Link Parent
      Those are a lot of fun. Great for making things into IoT devices. I hooked up an old coffee maker to an ES8266 so I could press the brew button wirelessly, and to see when the last pot was brewed....

      Those are a lot of fun. Great for making things into IoT devices. I hooked up an old coffee maker to an ES8266 so I could press the brew button wirelessly, and to see when the last pot was brewed.

      One thing I can recommend as a first order of business is to upload the FOTA sketch so you can program the thing remotely. This saved me from bricking one once. I forget how I did it but I think I tried using a pin that was needed for serial, and couldn't program it after that.

      3 votes
  7. [6]
    krg
    Link
    Still working on this from the last thread. I don't think I want to draw the fretboard (as in, making strings and frets n such) anymore. I'm kinda liking the aesthetic of plain text. Anyhow, I...

    Still working on this from the last thread. I don't think I want to draw the fretboard (as in, making strings and frets n such) anymore. I'm kinda liking the aesthetic of plain text.

    Anyhow, I made a scale builder and made a function to convert note numbers to note names. Still not quite sure how to decide whether to pick a sharp or flat version of a note, though. 🤔

    2 votes
    1. [5]
      unknown user
      Link Parent
      What's the issue you're facing here? Code? Representation?

      Still not quite sure how to decide whether to pick a sharp or flat version of a note, though. 🤔

      What's the issue you're facing here? Code? Representation?

      2 votes
      1. [4]
        krg
        (edited )
        Link Parent
        Representation. The note number is the note number, which can match to a pitch. No ambiguity there. However, in Western musical notation we see notes as a letter, possible sharped or flatted. For...

        Representation. The note number is the note number, which can match to a pitch. No ambiguity there. However, in Western musical notation we see notes as a letter, possible sharped or flatted. For example, note number 70 maps to the frequency of ~466.16 Hz, which can be represented as a B♭ or A♯ (in equal temperament) depending on what key you're in. But, also, depending on key some notes can have multiple sharps or flats. Well, right now I'm able to build the scale with proper note numbers and my note number -> note name converter mostly works, besides the issue of deciding to display a flatted or sharped note. The scale builder is the more important piece, anyway. I'll use that to selectively display what notes are on the fretboard. Eventually, I'll have an arpeggio builder or just a generic pattern builder (which is pretty much what I built, now that I think of it).

        These problems are pretty fun to think about, even if they've already been solved elsewhere.

        Edit: Maybe I should store the note names with an associated number that represents it's status, i.e. 0 for natural, 1 for one sharp, -1 for one flat, etc. Worst-case scenario, I just hardcode all the scales. But that's no fun.

        3 votes
        1. [3]
          unknown user
          Link Parent
          Has it been solved? If so, sounds like you're better off employing a solution others may be more familiar with. If not... You could use subscript to represent different states of the note. Are...

          Has it been solved? If so, sounds like you're better off employing a solution others may be more familiar with.

          If not... You could use subscript to represent different states of the note. Are most notes flat? Add a triangle or the Greek lowercase delta to indicate that this note is different.

          1 vote
          1. [2]
            krg
            Link Parent
            I have no problem displaying a note that is flat or sharp, but choosing which to display is the problem. A G major scale is as follows: G, A, B, C, D, E, F♯. My scale builder will represent that...

            I have no problem displaying a note that is flat or sharp, but choosing which to display is the problem. A G major scale is as follows: G, A, B, C, D, E, F♯. My scale builder will represent that as note numbers: 7, 9, 11, 0, 2, 4, 6. My note number to note name function will currently convert that to: G, A, B, C, D, E, [F♯, G♭]. Algorithmically building the scale using note numbers is no problem, but deciding when to display that 6 as F♯ or G♭ is the problem. A problem I don't mind resolving, as the point of this is just to get my brain gears moving. I'll think about it more, later, with some pen and paper. But I'm thinking storing the base note name and a number indicating its accidental status ([A: 0] for A, [B: -1] for B♭, etc.) is probably the way to go. Oh, base note names aren't to be repeated...so in the example above, I wouldn't choose G♭ because G is already used. I guess that's the solution.. or the beginnings of one. :)

            3 votes
            1. wirelyre
              Link Parent
              I think you have at least two options. Patterns are scale degrees (A+1 = B, A+2 = C) and MIDI note numbers. Then you can resolve a note name by calculating its sharpness/flatness. The number of...

              I think you have at least two options.

              1. Patterns are scale degrees (A+1 = B, A+2 = C) and MIDI note numbers.

                Then you can resolve a note name by calculating its sharpness/flatness. The number of sharps of a note is the difference between the MIDI numbers of the given note and of the scale degree.

              2. Patterns are sums of whole and half steps.

                Then you can keep a running count of the scale degree and sharpness. Each step, whole or half, increases the scale degree/note name. But depending on the specific note name, a whole or half step might also sharpen or flatten the running note.

                For example, A♮+half = B♭. E♮+whole = F♯.

              3 votes
  8. [3]
    unknown user
    Link
    Looking if I can implement infinite scrolling list in both directions on a web page. For the purposes of the experiment, I have a list of JS strings that render to paragraphs in a container....

    Looking if I can implement infinite scrolling list in both directions on a web page.

    For the purposes of the experiment, I have a list of JS strings that render to paragraphs in a container. Scrolling in either direction must put the next/previous entry after/before the last visible one.

    Also, no actual scrolling must occur: it's supposed to be work "by magic", for the purposes of illusion. This limits my methods to circumventing or riding on top of wheel events, or whatever the touch equivalent is. scroll doesn't work in a container when it's impossible to scroll, e.g. because its overflow is set to hidden.

    Also, no DOM overloading must occur: otherwise, this thing would cause performance issues very quickly. I'm already hijacking scrolling: I must be careful and keep operations during "magic-scrolling" to the minimum. If it runs smoothly on my dying laptop, it'll surely run smoothly on livelier hardware.

    So far, I'm thinking of a couple of methods:

    1. transforming the container
      Can't seem to model it working in my head. The only thing this is going to achieve on scroll is move the container visually on the page. What I need is to move the view, like moving a camera.
    2. having two supporting containers that move about
      On scroll, the two copycat containers (one above and one below the main one) calculate their visibility. Focusing on one container (i.e. having it take up most of the viewport) moves the supporting containers one on each side, so that the current container is surrounded at all times.
    2 votes
    1. [2]
      pseudolobster
      Link Parent
      Maybe I'm misinterpreting, but what if you just keep the strings in an array and shuffle the array around? <div id="box"></div> <button onClick="scrollUp()">Up</button> <button...

      Maybe I'm misinterpreting, but what if you just keep the strings in an array and shuffle the array around?

      <div id="box"></div>
      
      <button onClick="scrollUp()">Up</button>
      <button onClick="scrollDown()">Down</button>
      
      <script>
      arr = ["string one", "string two", "string three"]
      
      function renderBox() {
      	var box=document.getElementById("box");
      	box.innerHTML = ""; //empty div first. surely there's a smarter way to do this
      	arr.forEach( function(key,val) { 
      		var p = document.createElement("P");
      		p.appendChild(document.createTextNode(arr[val]));
      		box.appendChild(p);
      		} );
      }
      
      function scrollUp() {
      	arr.push(arr[0]);
      	arr.shift();
      	renderBox();
      }
      
      function scrollDown() {
      	arr.unshift(arr[arr.length-1]);
      	arr.pop();
      	renderBox();
      }
      
      renderBox();
      
      </script>
      
      2 votes
      1. unknown user
        Link Parent
        What you're accomplishing with this is shuffling lines among each other. What I'm trying to do is emulate scrolling with all its respective visual parameters (like deltaY, different for each user)...

        What you're accomplishing with this is shuffling lines among each other. What I'm trying to do is emulate scrolling with all its respective visual parameters (like deltaY, different for each user) so that it feels like the non-scrolling container is actually scrolling and that its contents are infinite.

        Substitution should definitely be a part of it. The problem I'm solving right now is how to (1) make it (2) resource-efficient and (3) performant, (4) in a way that feels exactly like scrolling.

        1 vote