u/pfp-disciple

I think I'm still confused about the practical use of std::move

Note: I'm working in Visual Studio 2013 for reasons, so I'm using C++11.

I get the idea of transferring ownership, but I seem to be missing something. Here's some sample code (off the top of my head -- work makes it hard to share real code)

std::string tmp = std::to_string(i) + std::to_string(j);
if (someCondition()) {
    const std::string tmp2 = getSomeString();
    if (IsValidData(tmp2))
        tmp = std::move(tmp2);
    else if (i == 0 && j == 0)
        tmp = "??";
    else
        tmp = std::move(tmp2);
}

Coverity is telling me that the std::move calls are ineffective. I added them because of Coverity suggestions on an earlier version of this code, and it made sense then. Since std::string has to own its data, I don't understand how the move is ineffective? Is it because I don't do anything else with tmp2, and thus ownership isn't an issue?

reddit.com
u/pfp-disciple — 1 day ago

Would Alabama ever invest in offshore solar power?

(apologies if this is a double-post. I don't see my first attempt)

I recently had an idea for offshore solar power, and thought it might work for Alabama. After a little research, it turns out there are companies working on the technology, as well as offshore wind power.

I have no idea whether it's actually a promising technology, but to my mind it sounds like it could be. Do you think Alabama will ever invest in this, or should they?

reddit.com
u/pfp-disciple — 3 days ago

Kindle Fire 7 (SR043KL) - what's the latest/preferred way to get a custom ROM?

I rediscovered an old Kindle Fire 7, and thought it'd be cool to put a custom ROM on it (maybe LineageOS, but I haven't looked if that's available). I'm not seeing anything especially current. The best I can find is some instructions on XDA Forum from 2019[1], and frankly I'm not sure exactly what that gets me. I have a lot of experience with computers, but not much with unlocking Android devices (most of my Android devices are from Verizon, so I can't get past the bootloader).

I'm hoping there's a more user-friendly set of instructions, especially one that will help me identify which generation device I have (the XDA link talks about "Ford" and "Austin").

[1] https://xdaforums.com/t/unlock-root-twrp-unbrick-downgrade-fire-7-ford-and-austin.3899860/

reddit.com
u/pfp-disciple — 5 days ago

Be informed - find your sample ballot for the upcoming elections

I'm gonna find my sample ballot and see what I can learn about the different candidates. I know many or most (I fear all) of the R candidates will be essentially the same (support the Pres), but the others (independent, D, Libertarian, whatever) might have some differences worth considering.

sos.alabama.gov
u/pfp-disciple — 5 days ago

Does anyone in town sell lower window sash?

I need to replace a window sash (sadly, I don't know the make nor model number). Looking online at Home Depot and Lowes, I'm only seeing entire windows. If I knew more about what I'm doing, I might be willing to look at an online-only source. But I've seen enough videos to know that Windows are more complicate than they appear and I'm likely to overlook (or misunderstand) some important spec.

The sash is removable, so the actual retirement should be easy.

P.S. it's a double hung window, with the two latches on top. Like most windows of houses built in the early 2000s

reddit.com
u/pfp-disciple — 5 days ago

Is there anything like a 'voidlinux-security' list?

The recent spate of kernel vulnerabilities got me thinking. Some of the larger distros have a "-security" mailing list or web page, showing the status of the current versions of packages. I'm sure I can just search for my currently installed version of the kernel and see its status compared to the latest official kernel.org build. But I don't see a simple^* way to (1) see whether/how much the void package differs from the kernel.org build, (2) what would be fixed if I update the kernel, nor (3) the same type of information for other packages.

I run void on a home computer that is non-critical, so my interest is mostly from curiosity, and from a past job where I had to track this kind of thing (in RHEL).

Right now, at least for the kernel, I suspect I'd do something like (scripted, eventually):

# xbps-query -S 'linux6.18*' --property pkgver
# xbps-query -RS 'linux6.18*' --property pkgver
Look up those versions and compare their changelog, etc. 

^* By simple, I mean trivially few steps.

reddit.com
u/pfp-disciple — 8 days ago

Heard on WLRH this morning - a presentation of local candidates' positions?

I only heard the tail end of this, so I don't have the details. It sounded like someone will be having a forum of some sort, to educate voters on the candidates.

I can't find anything on the WLRH website.

Can anyone share the info? It sounds like it could be helpful.

reddit.com
u/pfp-disciple — 9 days ago

[Hulk] Would the Hulk still have Banner's fingerprints, except larger?

I'm not sure why I happened to think of this. Would a fingerprint analysis connect Banner to Hulk?

reddit.com
u/pfp-disciple — 12 days ago
▲ 8 r/git

For context, I've never used format-patch, although I'm aware that i's used by the linux kernel, among other projects. My jobs have all been merge-based.

I saw a post in r/programming (about migrating from GitHub, but that's not relevant), that includes a section "What is 'patch-based' code review?". I'll copy the paragraph for context:

> What is "patch-based" code review? > > If you're familiar with GitHub's pull request workflow, you've done branch-based merges before. You prepare a branch with your changes, and then submit a pull request asking to merge your branch into main. If somebody gives you feedback, you push additional commits on top of your base commit. In contrast, with the patch-based merge workflow originally popularized by Gerrit, you amend the existing commit and push it — something like git commit --amend && git push --force. If you try this in GitHub, this would make the original commit you pushed disappear, but in patch-based review tools, your reviewers will instead see a diff from the original commit to the new one.

I thought git commit --amend replaced the prior commit, orphaning it. How would a subsequent git format-patch know to use the orphaned commit for its diff?

reddit.com
u/pfp-disciple — 15 days ago

(this is not intended to discuss the merits of repository vs AppImage vs Snap, etc. This is just a technical question about AppImage, and somewhat about xbps-install. Please be nice.)

I've not really had occasion to use an AppImage before (nor FlatPak, Snap, etc), although I've been reading the various discussions about the portable apps. My understanding has always been that an AppImage would be at least as large as the individual components it includes.

My new computer has a small-ish drive right now. I'm thinking about seeing if the game "0 A.D." would interest me, and I see that xbps says the "Size required on disk" is 3542MB. On the game's site, the AppImage is only 1.7G (similar to the xbps "Size to download", minor app version difference), about half the size. I'm not too worried about the approx 1G difference, but I am curios about whether I'd really see that difference in reality. Does the xbps size include some things (e.g. config files) that I might see after my first run of the AppImage?

reddit.com
u/pfp-disciple — 17 days ago

I've recently been given an HP Victus PC, and it's running /r/voidlinux quite nicely. However, it has a large bright blue LED "V" that is annoying at night. Is there a way (in software) to turn that off? Searching online, it appears that there's a Windows tool (HP Omen) that will control it. The Linux clone of it appears to only control keyboard LEDs.

reddit.com
u/pfp-disciple — 20 days ago

(background: I haven't messed with grub in several years, and then it was an end-of-life RHEL system).

Solved. See end for description.

I have a fresh install of void, this time on a UEFI computer (my first UEFI computer). I used the void-installer.

For this computer, I need to add "reboot=pci" to the kernel parameter, so I edited /etc/default/grub and appended reboot=pci to the end of the GRUB_CMDLINE_LINUX_DEFAULT entry.

When I run grub-mkconfig (to stdout to make sure I didn't mess up), the new file doesn't have the set locale_dir, set lang, and insmod gettext entries that are in the installer-generated file (inside an if loadfont).

  1. Do I really need the missing entries?
  2. Should I be surprised that I apparently can't regenerate the same file as the installer did?

SOLVED.

I looked at /etc/grub.d/00_header and see that because I have LANG=C.UTF-8, those entries are intentionally omitted.

reddit.com
u/pfp-disciple — 20 days ago

I find myself needing to output the human-readable value of a struct enum. In many cases, when I need to output the value I can cast it to an int, but there are some cases where I need the string "FOO". I'd rather not use a manually constructed lookup table, although that's feasible, because it feels like a lot of duplication. This is one of the classic situations for x-macros in C, but I wonder whether C++ has a cleaner idiom. I'm working in C++ 11 if it matters.

reddit.com
u/pfp-disciple — 23 days ago