Jonas Wielicki

Germany

sotecware.net

Age: 23

1d
awarded Good Answer
Apr
28
comment When my pc executes the code below why does it starts with 5?
The terminal you are using to view ("DOS window") only has a limited amount of scrollback. The lines before simply got lost and cannot be reached by scrolling up, because it will only save a certain amount of lines for you to view. If you try a different terminal emulator (I guess you’re out of luck there on windows) or run the program e.g. on ideone, you will see that your program is doing what you expect, only what you use to view the results does not behave as you expect.
Apr
28
comment Redirect output from program A to program B's input and viceversa
@MJGalram I added a few lines about mkfifo.
Apr
28
revised Redirect output from program A to program B's input and viceversa
clarify mkfifo
Apr
28
answered Redirect output from program A to program B's input and viceversa
Apr
28
comment Redirect output from program A to program B's input and viceversa
Which implementation of netcat? Some can do what you described you would do in C.
Apr
24
comment Dynamic array C++, trouble with new Obj[size] creating only 1 Object pointer, not array
The way to create a new dynamic array is to use std::vector. Why are you not using it?
Apr
24
answered How to not load font faces from desktop files?
Apr
24
asked How to not load font faces from desktop files?
Apr
21
awarded Yearling
Apr
21
comment Managing Fragmented Memory to provide Vector like functionality
You could also do things like use the contiguous patches as arrays and then have an additional patch with indexing, so that you can do binary search when looking up an element using its index. That reduces the complexity of index-based lookup to O(log H) (with H the number of patches), which may be better than O(H) (not in this scenario though, probably, due to number of elements). Think of it as a linked list of arrays. Even without the binary search index, you still get better performance, both memory and performance as you only need forward/reverse pointers for patches, not for elements.
Apr
20
answered Oops! N-channel Mosfet on sinking output
Apr
16
awarded Supporter
Apr
16
comment Makefile compilation
What does this have to do with makefiles? Also, post some code, the issue is probably in your code.
Apr
15
comment What is the safest way for programmatically writing to a file with root privileges?
@cas A lot can go wrong with bash, especially with user input. It isn’t that much better than C, I think both are a bad idea unless you know what you’re doing. The damage when using bash can be constrained by doing things like set -euo pipefail and carefully quoting everything, while in C you have to take care with memory allocation.
Apr
12
answered Shared feature branch that need to be in sync with master
Apr
10
awarded Nice Question
Mar
31
comment How should I implement, and what should I call, a common base class for Area and Point?
@MarkusMeskanen Nevertheless, python does stop you from adding strings and numbers. It makes sense to do that if you can do that trivially. Here, you are opening a huge barndoor of weird additions. In fact, anything which has __getitem__ implemented and does return a numeric value for foo[0] and foo[1] can be added to both Point and Area. I would argue that this is a surprise and may hide errors. Some safety by using sensible attribute names should be given. Even things like collections.defaultdict(lambda: 0) would be able to be added.
Mar
31
comment How should I implement, and what should I call, a common base class for Area and Point?
Note that this implementation will not stop Area() + Point() from happening. Which may or may not be what you want, but at least to me it does not make any sense.
Mar
27
comment Reason for High voltage difference between Ground and neutral wire in 3 phase system
@brhans Ah yes, I misunderstood. I thought you meant that N and B are swapped, because I implicitly assumed that the actual neutral would be grounded.
1 2 3 4 5