Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for ghost-in-the-zsh
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Comment | Post #291430 |
Keep in mind that the goal of this self-answered question was not to make module recommendations. Rather, it was to explain what the "big picture" differences are, between the modules, etc. (more) |
— | 10 days ago |
Comment | Post #291915 |
I'll add this last comment to note that the suggestion in this post skips the composite nodes and adds only the leaves, which deviates from the desired behavior mentioned in the OP. (See footnote #2.) (more) |
— | 24 days ago |
Edit | Post #292868 |
Post edited: Fix typo |
— | 24 days ago |
Edit | Post #292868 |
Post edited: Improve wording |
— | 24 days ago |
Comment | Post #292868 |
As long as you keep the caveat in mind. (more) |
— | 24 days ago |
Edit | Post #292868 | Initial revision | — | 24 days ago |
Answer | — |
A: Recursive traversal of composite tree of mutable "trait objects"? Here's the solution I ended up with a while back to traverse the (sub-)tree, starting at the given root component. In short, the model's field, `components`, is used directly and small `unsafe` blocks are used to push the root's children into the vector-backed queue that's currently being traversed. ... (more) |
— | 24 days ago |
Comment | Post #291981 |
> It doesn't really assume anything, it just asks why someone would consider it dangerous
It does make assumptions. Asking "Why is [it] dangerous?" is not the same as asking "Is [it] dangerous?". (more) |
— | 4 months ago |
Comment | Post #291981 |
The question just assumes the `auto` keyword is "dangerous". Are there examples that are "dangerous" that can be added into the OP? Is it simply surprising/unexpected behavior? Perhaps it'd be more useful to ask what the committee's *intent* is and the problem they're trying to solve with it? (more) |
— | 4 months ago |
Comment | Post #291915 |
> Just to be clear, I did actually take the code from your (original) post and got it to successfully compile with the changes I mentioned.
I think we may be talking past each other a bit, but I'm not sure where the (possible) misunderstanding crept in. Would you mind sharing a playground link wit... (more) |
— | 5 months ago |
Edit | Post #291913 |
Post edited: Remove numbering from diagnostic message, which could be confused with the list |
— | 5 months ago |
Edit | Post #291913 |
Post edited: Improve wording |
— | 5 months ago |
Comment | Post #291915 |
> could be fixed by [..] without needing to return a `Vec` [..]
Could you clarify what you mean?
> This doesn't matter [..] consuming that intermediate via `into_iter()` and then just passing `c` directly since it is the mutable ref we want.
Using `into_iter()` causes [other issues](https://... (more) |
— | 5 months ago |
Comment | Post #291915 |
I'll answer and/or clarify what I can.
> not sure what you're hoping
I've updated OP with a playground link.
> code will only return [..] "leaf"
Sorry. That was my mistake on the *mutable* traversal. I had a larger set of objects (in the concrete types version) when testing and didn't rea... (more) |
— | 5 months ago |
Edit | Post #291913 |
Post edited: Corrected some errors, added playground example links, and error message diagnostics from LSP. |
— | 5 months ago |
Edit | Post #291913 |
Post edited: Fix title typo |
— | 5 months ago |
Edit | Post #291913 | Initial revision | — | 5 months ago |
Question | — |
Recursive traversal of composite tree of mutable "trait objects"? I'm working on a background service/daemon for an embedded device, in Rust. The daemon manages several hardware components and these are structured using the Composite design pattern. The composite type from the pattern is called `Component` in the service: ```rust pub trait Component: // ..... (more) |
— | 5 months ago |
Comment | Post #286588 |
> Re: big targets: Hmmm, I would reconsider that after the xz backdoor.
Well, given that xz is/was(?) a widely-used piece of software, yes, they had a significant amount of attack surface area (i.e. thousands, even millions, of users). That's a big target. You as an individual? Not so much. (more) |
— | 7 months ago |
Comment | Post #287783 |
@#63752 I think using `open` makes more sense b/c it implicitly checks for your ability to read the file, which is necessary for the program to work correctly, among other things.
For example, in GNU+Linux, you could remove all permissions from the wallpaper file, including read, and `os.path.exis... (more) |
— | about 1 year ago |
Comment | Post #287851 |
I'd suggest that you overload the `<<` operator instead of having a `print` method. That way, you should be able to take your `Car c;` and write `std::cout << c << std::endl;`, and so on. This is what the `std::string` class does. (more) |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: Modify emphasis |
— | almost 2 years ago |
Edit | Post #287782 |
Post edited: Replace tag |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: Add note for gnome |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287782 |
Post edited: Remove TBD from Windows 7/10 sections |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: Add sections for Windows 7 and 10 |
— | almost 2 years ago |
Comment | Post #287783 |
After looking around the registry with the Registry Editor, I couldn't find anything else that seemed to indicate the *current* path to the current wallpaper or anything. So, it's very possible for the user to set an image as a wallpaper and then (re)move it, causing the Windows registry entry to end... (more) |
— | almost 2 years ago |
Comment | Post #287783 |
@#53177 It would be and that's what I was doing earlier today. Unfortunately, what I found is potentially unreliable. On Win7, had to use Python 3.7 (latest release that will work there). This code seems to work:
```python
>>> import winreg as w
>>> key = w.OpenKeyEx(w.HKEY_CURRENT_USER, 'Control ... (more) |
— | almost 2 years ago |
Comment | Post #287783 |
@#53177 No harm no foul. The way I got it to work from Python in Windows 10 was as follows (had to use a list for the commands, unlike in GNU+Linux):
```python
command = [
f'{env["SystemRoot"]}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe',
'Get-ItemPropertyValue',
'-Path',
... (more) |
— | almost 2 years ago |
Comment | Post #287783 |
I found a way to make it work in Python3 (in Windows 10). I'll be updating the post later. Also, while PowerShell *is* installed in Windows 7, the `Get-ItemPropertyValue` command returns an error message, suggesting the command is not implemented. (more) |
— | almost 2 years ago |
Comment | Post #287783 |
@#53177 Your method shows error messages when attempted via Python3's `subprocess` module. For example, `sp.run(f'{os.environ["SystemRoot"]}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe Get-ItemPropertyValue -Path "Registry::HKEY_CURRENT_USER\Control Panel\Desktop" -Name Wallpaper', capture_out... (more) |
— | almost 2 years ago |
Comment | Post #287785 |
Please, be sure to post error messages, log messages, configs, and other relevant data. Also, please do that as text, not images. (more) |
— | almost 2 years ago |
Edit | Post #284872 |
Post edited: Word change for readability |
— | almost 2 years ago |
Comment | Post #287783 |
@#53177 Does your Windows 10 recommendation work in the Home edition or does it really require the Enterprise version of it? Does Windows 10 Home even have Powershell available? (Not something I'm able to check right at this moment.) Also, are you aware of something in the Windows 32 API that could b... (more) |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: Add note on GNU distro. |
— | almost 2 years ago |
Suggested Edit | Post #284872 |
Suggested edit: Word change for readability (more) |
helpful | almost 2 years ago |
Edit | Post #287782 |
Post edited: Remove "(TBD)" mark from Gnome |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: Add Gnome section |
— | almost 2 years ago |
Edit | Post #287782 |
Post edited: Add emphasis on question |
— | almost 2 years ago |
Edit | Post #287782 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287783 |
Post edited: |
— | almost 2 years ago |
Edit | Post #287783 | Initial revision | — | almost 2 years ago |
Answer | — |
A: How to programmatically get current wallpaper file path? This answer will use Python 3 for code examples. I encourage people to post other answers for other languages. I'll continue to update this answer, as I'm able, based on comments with tested/verified recommendations/code/etc. Checking OS ```python import platform sys = platform.system().lo... (more) |
— | almost 2 years ago |
Edit | Post #287782 | Initial revision | — | almost 2 years ago |
Question | — |
How to programmatically get current wallpaper file path? I have written a screensaver program that, in part, uses the current wallpaper for some visual effects. However, finding the current wallpaper in different operating systems and environments is less than straightforward. I've made some progress, but what I've found during searches has not been ver... (more) |
— | almost 2 years ago |
Edit | Post #286800 | Initial revision | — | over 2 years ago |
Answer | — |
A: How to correctly daemonize a Rocket-based app? I did not find a way to get Rocket and Daemonize to work together without problems. However, I was able to get a more recent version of `start-stop-daemon` installed in the system (v1.20.11), and was able to get an `init` script working. (The old version did not recognize some options such as PID fil... (more) |
— | over 2 years ago |
Comment | Post #286697 |
OP appears to have ghosted the question. No response to questions, etc. (more) |
— | over 2 years ago |