home.social

Search

8 results for “digichelle”

  1. I also mentioned an unrelated C++ program. Here it is! I’ve shared it before, but didn’t say much about how it came to be.

    First, some background. I have three computers: a Linux laptop (specifically, a ThinkPad, because of course), a Mac laptop, and a Windows desktop. Typically, the Windows desktop serves as a gaming rig, but it also doubles as a file server. There are times when I need to pull things off the server on either of the laptops, but the Windows desktop is asleep. I could just walk over to it and wake it up, but no, that would take too much effort. So I enabled wake-on-LAN on the Windows desktop and wrote a tiny shell script on my Linux laptop that runs `wol` with my desktop’s MAC address pre-filled. The `wol` utility is available in most Linux package repositories, and Arch is no exception. All it takes is `sudo pacman -S wol` to grab it.

    Turns out it’s not so easy on macOS. There’s a variant on Homebrew, but it works differently. It makes specifying a broadcast IP address and port mandatory, which I found kinda odd. So I turned to MacPorts, but it turns out their `wol` port is broken. I tried downloading the tarball and compiling it myself, but that was also broken.

    Remember, I could just walk over to the desktop and wake it manually. But no, I decided this was a good opportunity to write my own `wol` implementation, because that would be easier?

    To be fair, I didn’t write it from scratch. Instead, I cherry-picked pieces of two existing C++ implementations and glued them together. The “gluing together” part forced me to actually learn the language and what the code did. The experience also taught me about build systems. Long story short, they all suck, and some suck more than others. Right now I’m using CMake, but I’m considering going back to using plain old make directly. CMake is kind of a lot, and overkill for this project.

    If possible, you should probably use an older and more established `wol` implementation. But if you wanna give my version a go, feel free!

    github.com/digichelle/wol

    #programming #CPP #CPlusPlus

  2. I saved the best for last. Or at least I thought I did. Boy was I wrong.

    Regular readers know I’m more of an Apple/Mac person. I’ve used and loved Macs for decades. I stuck with Apple through the malaise era, when the company was on the brink of ruin. I don’t feel as much affection towards today’s Apple, but I still prefer iOS to Android and macOS to Windows.

    In all those years, I never wrote software for an Apple platform. Now I had a convenient excuse to learn Swift and Xcode. I was feeling pretty good after my success with C# and Visual Studio, and I thought, how hard could it be?

    Now that I know the answer, I somewhat regret asking the question.

    When I started this leg of the journey, I didn’t realize that Swift 6 made a big deal of concurrency. Hell, I didn’t even know what concurrency was. Worse, a lot of the sample code I found was written in previous versions of Swift, so once acceptable code lit up the list of warnings like a Christmas tree. There’s also the matter of Swift being a fast-moving target. Every language evolves, every language changes, but Swift does it, uh, swiftly. There are a scary number of deprecations in Apple’s developer documentation, and that bit me in the ass countless times when repurposing existing code. The process of writing the program from start to finish felt like walking on a combination of thin ice and broken glass.

    Also, if you’re considering writing a CLI program in Swift, maybe reconsider? Even though it’s possible, after what I experienced, I don’t think it should be anyone’s first choice. But if you wanna do it anyway, here’s a tip. Don’t start with an Xcode CLI PROJECT, even though it’s an option. Instead, start with a new Swift CLI PACKAGE. It’s much easier to compile for release with the latter. Xcode makes that unnecessarily difficult. Running `swift build -c release` is much, much easier.

    Now I know why iOS/macOS/etc. programmers feel the need to scream on fedi periodically. Boy oh boy do I feel your pain.

    github.com/digichelle/odctl-mac

    #programming #SwiftLang #SwiftLanguage #Xcode

  3. Because MSYS2 and batch files don’t mix, I decided to redo my tortured but somewhat clever batch file as a proper, compiled program that runs anywhere. And then I had what I thought was a brilliant idea: why not use this as an opportunity to learn C#? If I’m gonna build a thing for Windows, might as well do it the Microsoft way, just to see what it’s like.

    Unsurprisingly, it was rough at first. Learning a new language—and learning Visual Studio on top of that—is kind of a lot. Thankfully, there’s a wealth of documentation and code samples available, and I have some prior experience with C and C++. Didn’t take me long to adapt to C#, which felt similar enough. It also helped that the batch file was structured like a C/C++ program, so I already had a blueprint.

    At the time, I found it frustrating, and there were plenty of times when I wanted to bang my head on my keyboard or some other solid surface. But now that I’m on the other side of it, you know what? I actually enjoyed it. I didn’t think I would enjoy C# and Visual Studio (because Microsoft), but it turns out I really like both.

    I liked both even more after the next part.

    github.com/digichelle/odctl-win

    #programming #CSharp #DotNet #VisualStudio

  4. Then I decided that I wanted macOS and Windows versions. This is where things get interesting. It’s also where the pain begins.

    My initial Windows implementation was a batch file. I dunno, it seemed like a good idea at the time. The result is the most tortured batch file I’ve written. I did some things that I thought were clever, like using `%ERRORLEVEL%` to simulate function returns in a language that, strictly speaking, doesn’t have functions. I also structured it in a way more akin to a C/C++ program, main “function” and all, which is definitely not the usual batch file paradigm.

    Much to my surprise and delight, it worked! I pulled it off. But there was a catch, and it wound up being deal-breaking in my case: I couldn’t run it in an MSYS2 environment. MSYS2 environments and batch files don’t mix.

    I needed a different solution, and that brings me to the next part of this slightly unhinged journey.

    github.com/digichelle/odctl-cmd

    #programming

  5. So, I did something silly. Several silly things, really. It’s so silly that I’m a little afraid to share, because many of y’all are Actual Professional Programmers™ who have been doing it for decades and I’m one step removed from being a total newbie. My code quality, and the choices I made reflected therein, are probably not great.

    But hey, I’m learning. It’s part of the process, right?

    Long story short, I wrote the same program four times, in four languages (Windows batch file, bash script, C#, Swift), for three different platforms (Linux, macOS, Windows). I also wrote an entirely different cross-platform program in C++. I’m not a big fan of learning things by following a textbook in chapter order. Apparently, I prefer EXTREME PAIN and baptisms by fire.

    The first program (the one I wrote four times) is OneDrive CLI control. Yeah, OneDrive. I would love to migrate to something else, but I have yet to find an alternative that works on Linux, macOS, and Windows that isn’t Dropbox (which doesn’t feel like much of an improvement, and is also more expensive to boot). Anyway, I store my development projects on OneDrive, and I’ll be the first to acknowledge that this is not a great idea. But at least I have the good sense to quit OneDrive before working on my projects, to prevent nasty sync errors.

    On macOS and Windows, I could quit OneDrive the normal way via the menu bar or system tray respectively. On Linux, I could just run `systemctl --user stop onedrive`. But I guess that wasn’t good enough for me. I wanted an fast and easy way of doing it without leaving my terminal emulator, and Microsoft inexplicably doesn’t ship their own solution. (Yet?) So I wrote my own. Multiple times.

    Linux was easy. It’s just a bash script that provides shorter aliases for `systemctl` commands. For example, the aforementioned stop command is reduced to `odctl stop`. It was laughably easy, and the script is less than 60 lines long.

    github.com/digichelle/odctl-li

    #programming

  6. I feel the need to mention that I DIDN’T USE AI, because FUCK AI. This is well-trodden ground for me, so no need to rehash all the reasons why I hate it so.

    But after all this, I admit, I understand why a lot of programmers are on board. There were plenty of times when I would’ve loved a ready-made solution to a difficult problem, or even just a nudge in the right direction. It could’ve saved me a ton of headaches, especially when working with Swift and Xcode. I felt the temptation several times and had to actively fight it.

    Ultimately, I didn’t give in, and I’m glad. I don’t think there’s ever a right time for cognitive offloading, but this was certainly the wrong time. Without AI, I’m forced to come up with my own solutions, and I’m forced to analyze why a solution works or doesn’t work. That process is critical as a beginner. Short-circuiting it would only make things harder later, when the problems become bigger and more complicated.

    Also, I enjoy problem-solving. It’s kind of my thing. I wouldn’t have survived in IT as long as I did otherwise. I’ve come to believe that the journey is just as important as the destination, if not more so. So enjoy the journey! Life is more fulfilling and more interesting that way.

  7. Also, hi Mastodon! Hi fediverse! Lots of things happening on my end, so many that I haven’t had a chance to stop and talk about them. Maybe there will be updates soon? Stay tuned!

  8. All these people seem to be shocked that NVIDIA’s Jensen Huang had two affairs, one with an alleged Chinese spy and another with an NVIDIA executive that reports to him. Meanwhile, I’m over here remembering when he signed a woman’s top.

    scmp.com/news/people-culture/t

Share on Mastodon

Enter the server where you have an account.