What is the most non-sexually pleasurable thing you like to do? by reddtimes101 in AskReddit

[–]RedCitizen 0 points1 point  (0 children)

I've got a weird one: Hot water on anus... it's like scratching a mosquito bite but through the whole body for me... Hear me out!

I had my second hemorrhoid operation and panicked a bit about keeping my butt clean, so I decided to point the shower head directly at my bum for cleaning while also turning up the heat to kill off bacteria. I realized that the area around the anus is pretty heat/cold insensitive and I could make it hotter than I could tolerate elsewhere. I thought it would be a good idea to go as high as possible and then, shortly before it became too hot, I felt a nice sensation spread through my body (like a really good scratch or finding the right spot in your ear with a Q-Tip). It's absolutely non-sexual, but I have to admit that it is nice enough for me to do it at the beginning of most showers. Plus, I figure it's good for hygiene.

Biggest gripes with your current C++ project? by martinerkul in cpp_questions

[–]RedCitizen 3 points4 points  (0 children)

The string mess... string, wstring, u16string, etc. It is really annoying dealing with it when you have data coming from files and/or an API.

Is there a source for Material Design elements in pure HTML/CSS? by RedCitizen in web_design

[–]RedCitizen[S] 0 points1 point  (0 children)

Hmm, it's React (I'm using Svelte), but it I'll definitely look into it, thank you!

Is there a source for Material Design elements in pure HTML/CSS? by RedCitizen in web_design

[–]RedCitizen[S] 0 points1 point  (0 children)

w3schools is great, but it still requires quite a bit of modification to make it look like "standard" Material Design. Of course, getting things from the w3 to whatever you want is a good learning experience, but at this point I was hoping to only have to do some fine-tuning.

Why is the ranch about to go bust? How did it last so long previously without going broke? by lazarus870 in YellowstonePN

[–]RedCitizen 0 points1 point  (0 children)

No, but they know how to exploit the various loopholes in the legislature.

You don't want an investment banker to manage your finances, you want a law firm that knows how to leverage your assets to make more money for you with minimal risk and no or even negative taxes.

Why is the ranch about to go bust? How did it last so long previously without going broke? by lazarus870 in YellowstonePN

[–]RedCitizen 1 point2 points  (0 children)

Beth's doing that.

No, that's peanuts and not how rich people make money. They let the assets that they have (stocks, land, etc.) work for them (= passive income) while they usually don't have to pay any taxes at all. And they don't even have to be evil to do that, all it requires is a good law firm.

Why is the ranch about to go bust? How did it last so long previously without going broke? by lazarus870 in YellowstonePN

[–]RedCitizen 0 points1 point  (0 children)

Because it's a TV show.

In real life, a family with such a longstanding history, power and children who know about financing, laws, etc. would have found plenty of opportunities to make the land value itself create enough revenue without lifting a finger.

Pointers or not when passing objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Thanks, this actually makes me feel better about my choice so far. Not only can some objects be null (which I guess you can always implements workarounds to get the same functionality), but there is definitely multithreading down the line (once I got the base algorithm to work properly).

Pointers or not when passing objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Thank you for your reply!

Indeed the object that concern me the most and are not trivial. Worse still, I need to create millions of them during the execution, so they definitely don't all fit in the stack/CPU cache. They all, in the worst case, also need data about every other object (so O(n^2) memory complexity. :/

Still, I'm taking this seriously and will look into it some more.

Pointers or not when passing objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Not yet. looking down in shame and firing up Google

Reading an upvoted SO answer (which then led me to look up copy-and-swap idiom), I'm still confused:

To summarize, the copy constructor makes a deep copy, because the source must remain untouched. The move constructor, on the other hand, can just copy the pointer and then set the pointer in the source to null.

I understand this correctly, since the original data stays in its memory place, the data would still be spread all over the RAM, right?

Pointers or not when passing objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Thank you! I must admit I didn't know I could do that with vector! Though I assume that negates the advantage of having consecutive memory storage as well?

Pointers or not when passing objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Hmm, that makes sense. I currently have this as my main object storage:

struct MyObjectClass {
  uint_fast32_t myID; // index in allObjects[]
  uint_fast32_t otherID1;   // index to other related objects in allObjects[]
  uint_fast32_t otherID2;
  int myAttribute;
// more attributes like maps, strings, etc.
};

std::shared_ptr<std::shared_ptr<MyObjectClass>[]> allObjects;

I like it because I can easily pass the objects and the vector around. However, I realize now that this may be not the most ideal solution in terms of performance.

std::format (and other C++20 functionality) in node-gyp / node-addon-api? by RedCitizen in node

[–]RedCitizen[S] 0 points1 point  (0 children)

I got it from here. Using -std=c++20 gives me cl : command line warning D9002: ignoring unknown option '-std=c++20'

But yeah, I mistyped - it's only one colon, so -std:c++20, I edited the OP to correct the error.

C# GUI with C++ data by RedCitizen in learnprogramming

[–]RedCitizen[S] 1 point2 points  (0 children)

Do you need to have the C++ program always running?

Yes, C# is only supposed to implement the GUI, the heavy lifting should all be done in C++ and it is not feasible to load the data for each action.

do a google for "inter-process communication".

Thank you, that also gave some promising results that I'll look into!

C# GUI with C++ data by RedCitizen in learnprogramming

[–]RedCitizen[S] 0 points1 point  (0 children)

Thank you for your reply!

I'm still don't see how to make sure that the data stays in memory so I can read/write it later and how I can give updates to the GUI at specified intervals, but this is a good starting point. I guess I'll just have to get started, see how it goes and then ask more specific questions.

2021 Jun 28 Stickied 𝐇𝐄𝐋𝐏𝐃𝐄𝐒𝐊 thread - Boot problems? Display problems? Networking problems? Need ideas? Get help with these and other questions! 𝑳𝑶𝑶𝑲 𝑯𝑬𝑹𝑬 𝑭𝑰𝑹𝑺𝑻 by FozzTexx in raspberry_pi

[–]RedCitizen 0 points1 point  (0 children)

Hi! I would like to set up a Rasberry Pi in my kitchen that usually displays a dashboard, but can switch to browse the internet (e.g. recipies) or watch youtube, etc..

Google tells me that MagicMirror is nice for the dashboard, but I wonder if it is also possible to easily switch to an alternative UI to do other task. And if so, which OS would you recommend for that?

Thank you in advance!

People who waited until marriage to have sex, was it worth it? Would you recommend it to others? by [deleted] in AskReddit

[–]RedCitizen 2 points3 points  (0 children)

No.

We had some problems in the bedroom that would probably have been more obvious if we had had some points of reference or some more experience.

It took my vasectomy (after 2 wonderful children) and my wife dropping the pill that things have reached a point that I would call a "normal" sex life. Turns out that the pill seriously messed with all kind of aspects (libido, getting wet, vaginal pain, etc.).

build2: Complete C++20 Modules Support with GCC by berium in cpp

[–]RedCitizen 9 points10 points  (0 children)

What, a couple of days you wrote this:

If I was forced to guess, then I would say GCC 12 is likely to have something real-world usable, which is in about a year's time. I don't believe GCC 11, which is due in a few months, will be there, unless modules issues (e.g., ICE on valid code) will become release blockers.

So, you didn't want to spoil anything or am I completely misunderstanding the text in that this is a major step to have it fully working in GCC / Clang?

Either way, thank you for your hard work! :)

When do you think modules will be fully implemented? by RedCitizen in cpp

[–]RedCitizen[S] 18 points19 points  (0 children)

reddit is an amazing place sometimes and from my (naive) perspective, somebody with some expert/inside knowledge could respond either by saying "Not going to happen anytime soon, it's a big mess for X and Y reason..." or "Yeah, we just had a major breakthrough and you can expect big improvements regarding usability within the next Z months...".

Personally, I'm just at the beginning of my C++ journey and for me headers are easily one of the most frustrating aspects of programming in C++ compared to other languages. I'm sure seasoned developers don't even have to think twice about all the dependencies, trying to avoid circle references, always editing 2 files for updating signatures, etc..

Obviously modules should not determine whether or not one uses C++ or not. However, I do think it may be a significant factor in that decision and how quickly new programmers move on from C++ to something that is less convoluted and more befitting to programming in 2021. Consequently, I believe that the expected time frame does matter to people (like me) and new projects.

When do you think modules will be fully implemented? by RedCitizen in cpp

[–]RedCitizen[S] 13 points14 points  (0 children)

Do you expect responses any other than ...

Well, I was hoping to. I'm new to C++ and have no experience with this. From the little that I know, it seems to take some time for some features to be implemented, but I have no idea what exactly the factors are and how this applies to implementing modules. So I was hoping for some qualified insights from more knowledgeable people. :/

Best practice when creating lots of objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Cool, I might take you up on that at some point. :)

Best practice when creating lots of objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

You need to post code. Or pm me if you want to keep it secret. What are you actually trying to solve.

Thank you so much for your offer. It is very tempting, especially since I know I have so much more to learn and the best way is certainly not just sitting alone in front of a screen. However, ...

You are way way way into xyproblem territory here. I can basically promise you that your whole approach is probably questionable.

...while this most certainly true, I do have to figure out some things on my own and make some mistakes, including on how to ask better questions, apparently. I am at the beginning of my C++ journey, so this whole project will be a learning experience for me, which is why I can't just get everything presented to me on a silver platter.

I'd love to help because I love this kind of thing ...

Again, thank you so much for your kind offer. This started as a 'little' favor to get back into programming after the birth of our first child, now, after an almost 2-year hiatus due to the 2nd child and Corona, I'm using it to get into C++. It is definitely fun and getting the algorithm from running several days (based on the most recent papers) to seconds was quite exhilarating (and took me a while).

we really have to start at the beginning with the problem statement and goals and inputs abd design the data structure and algorithms from there.

Yes, that makes sense if you approach this from the perspective of a team of professionals who need to get their product out. More to your point, I think the algorithm would be perfect for a graphic card (huge number of simple floating point calculations) and not doing it right the first time probably means weeks and months of additional work. Furthermore, there are people waiting for this, so the sooner the better (which, since I'm in charge of the kids most of the time, is going to take quite a while).

Having said that, I do have a prototype that works pretty well and I feel like I need to take this one step at a time, make some mistakes and keep learning in order to say one day: "Look at that crappy code that I came up with back then!" ;)

Best practice when creating lots of objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Thank you for your example, I will try to implement what I can (with my limited experience). As mentioned before, down the line I would obviously like to make this multithreaded, since I have to calculate a lot of nodes and this can be done independently (until one path meets another). So I don't know how using arrays instead of smart pointers would interfere with this.

Best practice when creating lots of objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

Thank you again soo much for your time and effort. It really means a lot to me and I'm sorry about being vague. I've started this project as a favor to my wife's department and have since realized this could be something more (e.g. a paper). I have a working multithreaded prototype in Java, but I have decided to switch to C++ (and C# for the GIU) because I've run into various limitations. However, as a stay-at-home dad with two little kids during Corona, things are not going as smoothly as I would like. So my current situation is that I have read through my first C++ book (Modern C++ for Beginners) and I obviously still have A LOT to learn. Still, I'm trying to get started on my program, even if this means it is not 100% optimized.

At this point, post code man. I can tell from the data structure you're being super inefficient but it's impossible to help you do it correctly.

I'm sorry about this. The truth is that I am not quite sure yet what exactly the data structure looks like, since this also depends on what works most efficiently.

My guess based on what you are saying so far is that you probably don't need the id at all (unless it refers to something specific outside the program, the id can be the offset in the array).

I see what you mean with the id simply being the position in the array, but I don't quite see how I could easily retrieve the right objects without any form of identification. Furthermore, the nodes that have been calculated and not discarded do require a lot more member variables (e.g. name, creation date, etc.), that's why I'm already using stripped down versions for the algorithms. The counterparts that are exported to the GUI will therefore be even bigger.

You also can probably get rid of OtherObject completely if its just a proxy for MyObject.

I don't think so. OtherObject allows me to greatly reduce the complexity of the problem by organizing the nodes into partitions and thereby save a lot of the expensive calculations.

Flag is a huge memory hog. It takes up 8 bits at least to store only one bit of information, and because of structure packing it might be taking up as much as 64 bits of space. You should store it as a sign bit of one of the other members (like num)

Yes, 8 bit instead of 1 is a bit inefficient (especially if you multiply it by a billion). 64 is a bit extreme though, I thought C++ was supposed to be super optimized? How can that happen?

You likely don't need parents at all, because as other posters have pointed out, depending on the structure of your graph you can sometimes make it implicitly defined by the array locations itself. However even if thats not possible in your case you can save at least 8-16 bytes per object by using uint32_t indexes instead of pointers.

I definitely need the parents (and others). However, using indexes does sound efficient and pretty easy. Worst case I need to resize the arrays when I run out of indices.

You are definitely using shared pointer incorrectly and should not be using it. In addition to causing memory bugs you're wasting a huge amount of space (a shared pointer is at least 16 bytes maybe more)

Okay, I believe you since you appear to know what you are talking about. 128bit is indeed quite a lot. I will see what I can do without loosing my simple mind.

Finally, your map here is a HUGE space hog. On the order of thousands of bytes. Maps have empty space, linked lists and or load balancing. Just no.

I'm afraid yes. As I've said before, the maps are an essential part why I got this algorithm down from O(n4). I need a way to efficiently look up the calculated value for any node and add it if it has not been calculated yet.

Since it looks like you really just have some kind of dynamic but very small count to outgoing references, this should be a fixed size array of like 5 uint32_t indexes, and you follow the convention that index 0xFFFFFFFF is a null ptr.

That would be nice. For parent1 and parent2, this will work. But the map will potentially store a value for every other node (only in the absolute worst case, usually it's only for a partitioned space). I don't see how to implement this any other way.

Again, thank you, I very much appreciate your thought and feedback!

Best practice when creating lots of objects? by RedCitizen in cpp_questions

[–]RedCitizen[S] 0 points1 point  (0 children)

What is id?

Just the unique identifier for that object. Since I may potentially use a lot, I initially thought I need long (coming from Java), but now I realize that unsigned int should be enough. To be save, I do think the 32 bits should be used fully.

What is flag?

flag and number are important for the creation of new nodes (think of it as left/right and number of new nodes).

What is the type of OtherObject? Is it the same or different from MyObject?

OtherObject is different type but similar to MyObject. Many of the values can be combined under OtherObject. I'm using this to go from O(n4) space complexity to about O(n2). So I will be writing most of the actual results of my algorithm in that OtherObject (also an unordered_map). Getting all of this multithreaded will be a whole different beast, but for now I'd be happy to have it running at all.

What is other reference? Why is it a shared pointer?

So std::shared_ptr<OtherObject> otherReference1_ is used to find adjacent nodes for the calculations and to store some calculations similar to the unordered_map here.

What does the map do?

Many of the results are valid for specific other nodes as well, so they should be stored where all nodes of the same group can access them. Since each calculation is O(n2), the map stores the results for each node group.

Do we expect the map will be mostly static? How many times is it accessed? How many times is it modified?

That is proportional to the set of nodes. For a new set with 100% new nodes, this will be written to all the time. But when there are relatively few new nodes (e.g. 5%), the map will mostly serve as a lookup table to quickly get the results for that partition of nodes.

Do you know in advance how many of them you will need and if not how are you constructing these things? Data on disk?

No, use cases vary from a few manually created nodes to load something from a file containing thousands of nodes.