Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

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 elgonzo‭

Type On... Excerpt Status Date
Comment Post #285956 @#8176 i guess this could be a matter of refactoring support offered by IDEs. I don't have a good overview over the refactoring capabilities across different popular C/C++ IDEs, but it would probably be much easier to implement and offer a refactoring assistant that can reliably track and variable id...
(more)
over 2 years ago
Comment Post #285956 @#8196, thanks for adding a footnote to your question text that contextualizes where you see the reduction of code duplication. Otherwise, in a general sense there would still be no reduction in code duplication, because changing the variable name instead of the type identifier would also require thr...
(more)
over 2 years ago
Comment Post #285956 As an advantage of `malloc(n * sizeof *p)`, i would consider the locality (in terms of location in the source code) of the identifiers used in `p = malloc(n * sizeof *p);`, thus potentially reducing the chance of coding mistakes when a function declares a number of pointers (or a program when global/...
(more)
over 2 years ago
Comment Post #285956 With ``` int *p; p = malloc(n * sizeof(int)); ``` the type identifier ("int") is being duplicated, thus one duplicated token. With ``` int *p; p = malloc(n * sizeof *p); ``` the variable identifier ("p") is being duplicated, thus one duplicated token. Where exactly is there a reductio...
(more)
over 2 years ago
Comment Post #285838 > would use a database table in most cases. Yeah. In my comments, i was focusing only on the question which was about switch-case compound statements used as value mapping/translation as part of C# code. Of course, if value translation/mapping needs to be configurable or extensible, or otherwi...
(more)
over 2 years ago
Comment Post #285839 Then remove the `checked` keyword from the `GetSumChecked` method: ```C# [MethodImpl(MethodImplOptions.NoInlining)] private static int GetSumChecked(int[] numbers) => numbers[0] + numbers[1] + numbers[2]; ``` and run the benchmark again. (Now it should be apparent why i suggest separate Ge...
(more)
over 2 years ago
Comment Post #285839 To do so, the benchmarks should be altered so that the code for the checked and unchecked case is isolated into separate methods. Keeping as much of your current code base as possible, i would do this (not sure if you need to add `[MethodImpl(MethodImplOptions.NoInlining)]` to prevent inlining, but d...
(more)
over 2 years ago
Comment Post #285839 Just a stupid idea: What if the observed results are not due to the use of _checked_, but an artifact of the JIT compiler or due to external factors influencing your benchmark run (like, do you have other stuff running on your box that might possibly intermittently load the CPU and chew cycles)? T...
(more)
over 2 years ago
Comment Post #285838 Generally, if a switch compound statement only serves to translate/map values, replace it with a switch expression. If the case branches feature side-effects (some other code besides returning a value), either keep it a switch compound statement or refactor it into a switch expression with the cas...
(more)
over 2 years ago
Comment Post #285838 > (i.e. each nonempty case must use break or return) ... or a goto with to a case label or the default label ... <BR> Out of curiosity, i wonder what SonarQube would say about switch expressions. Because, using a dictionary just moves the complexity from a switch compound statement into t...
(more)
over 2 years ago
Comment Post #285812 I don't have the faintest clue of all the class identifiers you are throwing around there in your Bootstrap example and what possible CSS definitions they might (or might not) be associated with (heck, i don't even have the slightest experience in Bootstrap to begin with), but could it perhaps be a w...
(more)
over 2 years ago
Comment Post #285620 Just an idea... What happens if you don't put the Hebrew character literal in the javascript code, but instead use its character code, i.e.: ``` event.key === '\u05DA' // final kaf ``` or ``` event.key === '\u05DB' // kaf ``` Not sure if it will work, but might be worth a try i...
(more)
over 2 years ago
Comment Post #285579 Yes, memory-mapped I/O is the only way to do it with standard-conform C in a freestanding implementation, and typically involving `volatile` -qualified types. (I erroneously mentioned in my previous comment that port-based I/O could be done in a C standard-conforming way as well, but that is obviousl...
(more)
over 2 years ago
Comment Post #285579 > This would mean that every kernel ever written that has any I/O of any kind is not standards-compliant C. Again incorrect. Memory-mapped I/O can be done entirely in C without needing language extensions nor code modules written in other languages. Depending on the actual architecture or specific...
(more)
over 2 years ago
Comment Post #285579 Any code that is not part of the C source code (such as a function provided by some object/machine code written in assembler) has its behavior obviously not described by the C source code nor the C standard, and from the perspective of C is thusly undefined behavior. (In other words, neither the C st...
(more)
over 2 years ago
Comment Post #285579 > This would mean that every kernel ever written that has any I/O of any kind is not standards-compliant C. Incorrect. You cannot become non-compliant by "violating" non-existing parts of the standard. With regard to linking object/machine code that is written in other languages then C (like f...
(more)
over 2 years ago
Comment Post #285579 > If so, there should be reference to it within the C standard somewhere, and I'd like to know exactly what can be said about linking C translation units with other non-C libraries. It is implementation-defined, and therefore not described nor referenced in the C standard, precisely because differ...
(more)
over 2 years ago
Comment Post #285580 > Therefore, the C standard cannot confine itself solely to rules applying to a single translation unit; it must have something to say about linking. It does. See section 6.2.2 Linkages of identifiers. In case you don't have the actual C standard at hand, here is the PDF for C18: http://www.open-s...
(more)
over 2 years ago
Comment Post #285580 > By that reasoning, if a function is never defined, the program should fail to compile. If your code calls some externally defined function, and the linker is unable to link the call with the actual function implementation because there is no such function implementation, of course the build will...
(more)
over 2 years ago
Comment Post #285580 (2/2) Compilers might (and often do) provide additional keyword extensions not covered by the C standard to allow specifying a particular calling convention (such as `_stdcall`, `_cdecl` or `_fastcall`, for example). If your interrogation of "_[...] from the standard's perspective, what happens wh...
(more)
over 2 years ago
Comment Post #285580 I am not quite sure what you are trying to ask about, but i am assuming for now you are asking wrt calling conventions. The C standard is unconcerned about calling conventions and does not try to lay down a "law" about that. It explicitly leaves the layout of storage for parameters of externally defi...
(more)
over 2 years ago
Comment Post #285573 I am not trying to be facetious or snarky here. A debugger is a fundamental software development tool. I would go as a far as saying that a debugger is almost as fundamental as the text editor function required to write and edit source code and the compiler or interpreter required for processing the ...
(more)
over 2 years ago
Comment Post #285573 > Why is it like that? If you have difficulties understanding what your program is doing and just looking at the source code doesn't help you get an understanding, then it's time to use a debugger to inspect and observe what your code/program is actually doing, and why it behaves the way it does.....
(more)
over 2 years ago
Comment Post #285573 See comment topic title, obviously... (There is a way to make the data type available as a data type named "Node", but i won't tell you here right now because i believe doing so would confuse you even more...)
(more)
over 2 years ago
Comment Post #285558 All in all, without making sweeping assumptions about what specific CPU SKUs are in the nodes the asker is using, i think the Win32_Processor caption string provided by WMI is not that practical, unless you already have a table that maps CPU family/generation + (extended) model number to feature set....
(more)
over 2 years ago
Comment Post #285558 > The AVX2 features were introduced in the Haswell family of chips, which I believe will show up as family 6, model 195. Models older than that can use the non-AVX2 build. With respect to Intel, if it only were that easy. Not all Intel processors in the same family/architecture do support AVX2. Fo...
(more)
over 2 years ago
Comment Post #285205 @#54710 (2/2) Only if you have accomplished these three tasks (write text lines to a file; read text lines from one file and write them to another file; using strstr) individually and independently, **and only then**, it is time for the concluding task: Combine the text line reading and writing with ...
(more)
over 2 years ago
Comment Post #285205 @#54710 Start with figuring out how to _write_ strings/text lines to a (new) file. Don't think about finding and removing text lines, yet. Solve this task first. Exercise it, make it work successfully. If you have accomplished that, figure out how to read a text line from a file and write it to an...
(more)
over 2 years ago
Comment Post #285303 @#54710 https://software.codidact.com/comments/thread/5285
(more)
over 2 years ago
Comment Post #285298 Don't make your life more difficult than you have to. Do you really want to find a word (in the orthographic sense) in some text line of your text file? At your current skill level, this would not be trivial for you, a fountain of frustration and a distraction rife with disappointment. Searching f...
(more)
over 2 years ago
Comment Post #285205 @#54710, no, there is no such function available -- not as a single function. Modifying file content is highly specific to the individual application scenario or use case. Since this cannot be really well generalized to cover a wide gamut of use cases, you will be hard pressed to find any such a func...
(more)
over 2 years ago
Comment Post #285191 Ajax is frontend-side (client-side). If you want to keep the email address in the backend (server-side), then it is a backend concern, not a frontend/Ajax concern. Therefore, the answer to your question "_What Ajax pattern will you use to do so?_" will be "_None_", because it is of no concern to the ...
(more)
over 2 years ago
Comment Post #285183 For now i personally feel it would serve you much better if you separate both concerns (modelling you application/business logic + data structures vs. the implementation of the logic + data structures), and try to do them separately and sequentially as much as possible. In the future, if you have ...
(more)
over 2 years ago
Comment Post #285183 Before you start coding/implementing, spend some effort in actually designing/modelling both the desired application/business logic and the related data structures in detail and completely. From your code snippet, it rather looks like that you started coding just with a vague notion but lacking a ...
(more)
over 2 years ago
Comment Post #285177 Because the array can be thought of as a representation of a binary tree, specifically a "**complete binary tree**". Now, if you know the array index of some node/element in the tree, how would you get the array indices of the two children nodes/elements, or the array index of the parent node/element...
(more)
over 2 years ago
Comment Post #285177 ... in other words "heapify" describes the act of turning something into a heap data structure. Within the context of heapsort, this describes turning a binary tree into a "max heap" / "binary heap". The `heapify()` method does just that. (Btw, a max/binary heap is just a binary tree obeying specific...
(more)
over 2 years ago
Comment Post #285130 Ah, i see. I unfortunately cannot offer help with your problem. However, you might perhaps mention in your question that your frontend is using Ajax, and which thusly might encourage Ajax-based solutions that might be simpler/easier than plain/pure non-Ajax JavaScript (unless you seek a solution that...
(more)
over 2 years ago
Comment Post #285135 From one of the documentation pages for fopen (https://linux.die.net/man/3/fopen): > Upon successful completion fopen(), fdopen() and freopen() return a FILE pointer. **Otherwise, NULL is returned and _errno_ is set to indicate the error.** > The fopen() function may also fail and set _errno_ ...
(more)
over 2 years ago
Comment Post #285130 What exactly are your reasons to prevent the default behavior? Actually, what precisely is the behavior that you summarily describe as "default behavior" and that you desire to prevent? Have you thought about _not_ preventing that "default behavior" but just preventing the user from triggering the...
(more)
over 2 years ago
Comment Post #285130 @#36363 > (perhaps you meant to say that they should be the same?). No, i did not say this, and i did not mean to say this either. I just said that you have to use the correct URL, whatever the actual correct URL is. (I am not going to wildly speculate about what the correct URL might be. You are...
(more)
over 2 years ago
Comment Post #285130 @#36363, the endpoint of a request is given by a URL, not a file. If the URL itself specifies some file name, then it's just part of that URL. The correct URL for a request (and what data and in what shape that data has to be included in the request) depends on how you have the backend implemented an...
(more)
over 2 years ago
Comment Post #285130 If you are looking for examples of how to make requests with the `fetch()` method (including POST requests), you might want to take a look here: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
(more)
over 2 years ago
Comment Post #285130 `fetch()` is chiefly about making requests, and is not about "actions" or "php". So why would you expect `fetch()`'s documentation to say something about random things that are not about requests themselves? And how you should realize your `fetch()` or `submit()` depends entirely on **how** you h...
(more)
over 2 years ago
Comment Post #285118 Clearly, `compare` is a function pointer **and** an input parameter for the BubbleSort method. But in your _main_ method, you don't provide a function pointer there: `BubbleSort(A,6);` What do you think will happen because of that omission? Furthermore, with regard to your Q "_What does the grea...
(more)
over 2 years ago
Comment Post #285068 Whether TamperMonkey offers alternative mechanisms for fragment matching, i don't know. But even if it would have such a mechanism, I would have a hard time understanding how this could possibly work satisfactorily. Navigation based on URL fragment where the scheme/host/path of the URLs stays the sam...
(more)
over 2 years ago
Comment Post #285068 The question then boils down to how could you possibly match against a given fragment in a URL. Frankly and unfortunately, i don't know. Content script match patterns basically can match schemes, hosts, and paths (https://developer.chrome.com/docs/extensions/mv3/match_patterns/). Note that it does no...
(more)
over 2 years ago
Comment Post #285068 Important side note: The URL `https://example.com/%23/login` is quite different from the URL `https://example.com/#/login`. I am talking about actual URLs here, i am _not_ talking about URL patterns. **Do not make the mistake** of treating them as equivalent forms of the same URLs. They are not the ...
(more)
over 2 years ago
Comment Post #285068 In an URL, the `#` is called fragment identifier, followed by the actual fragment. It is important to understand that fragments are **NOT** part of the path in an URL. For example, all the following url's have the _same_ empty path: `https://example.com/`, `https://example.com/#`, `https://example.co...
(more)
over 2 years ago
Comment Post #285019 ... therefore you get a big **shrug** from me. But note that depending on the actually web site/page you are messing with and depending on how and precisely when your little Javascript runs, you might get different results...
(more)
over 2 years ago
Comment Post #284935 (P.S.: Since it is unclear to me whether you actually were asking about _textContent_, and also due to the vagueness of the other question you posed, i decided to just write a comment. If the two questions are being clarified, i would transfer my comment to an answer, provided my comment still applie...
(more)
over 2 years ago