body
stringlengths
25
86.7k
comments
list
answers
list
meta_data
dict
question_id
stringlengths
1
6
<p>This is partially inspired by this <a href="https://codereview.stackexchange.com/questions/269755/bigbytelist-with-a-managed-wrapper">question</a></p> <p>I have started creating an example to show how to keep certain parts of the array on disk and came up with the following:</p> <pre class="lang-cpp prettyprint-ove...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T20:35:34.187", "Id": "532662", "Score": "0", "body": "Why not use `MapViewOfFile` ?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T20:41:01.527", "Id": "532663", "Score": "0", "body": "@J...
[ { "body": "<h1>Safely creating a temporary file</h1>\n<p>Creating a temporary file safely is harder than you think. The way you do it is unfortunately not safe. For the Linux version, you are ignoring the return value of <code>mkstemp()</code>, this leaks the filedescriptor. Another process might replace the te...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T16:39:54.213", "Id": "269884", "Score": "3", "Tags": [ "c++" ], "Title": "Creating large arrays using limited amount of RAM" }
269884
<p>I wrote the following code to read out a bill from a file and then putting it into a bills-list.</p> <p>The bill contains: &quot;company&quot;, &quot;customer&quot;, Year, Month, Day, Amount, &quot;credit/debit&quot;</p> <p>Is there a nicer way using list comprehension to make this code look better?</p> <pre><code>d...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T17:18:20.897", "Id": "532646", "Score": "0", "body": "Use Pandas? That will make this one line." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T17:27:55.467", "Id": "532647", "Score": "0", ...
[ { "body": "<p>The least appealing, most tedious part of the current code is the conditional\nlogic to handle data conversion. Since you're dealing with a limited number of\ncolumns, you can use a data structure to eliminate the conditionals. (In my\nexperience, smarter or more convenient/suitable data structure...
{ "AcceptedAnswerId": null, "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T16:59:48.020", "Id": "269885", "Score": "4", "Tags": [ "python", "homework" ], "Title": "Read bills from a bills.csv file" }
269885
<p>Have you ever written proxy objects, instead of using a setter and a getter method? In that case, I'm interested in your opinion on the following design for a templated proxy.</p> <p>This is a second version, after addressing comments from a <a href="https://codereview.stackexchange.com/q/245747/64513">previous revi...
[]
[ { "body": "<h2>std::ref to the rescue</h2>\n<p>I believe that most of the places where references are used could be replaced with value type in the class and the user could just <code>std::ref()</code> their objects/callables (in this specific case, not in general). <code>std::reference_wrapper</code> provides ...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T22:00:28.077", "Id": "269889", "Score": "2", "Tags": [ "c++", "c++11", "design-patterns", "template", "proxy" ], "Title": "A proxy class as a generic replacement for gette...
269889
<p>I've implemented this rotate_ algorithm mimicking STL's : The algorithm left-shifts all the elements n times where n is the distance between the first element and the axis (middle):</p> <pre><code>template &lt;typename InIt&gt; InIt rotate_(InIt first, InIt Rit, InIt last){ if(first == last) return last; ...
[]
[ { "body": "<ul>\n<li><p><code>distance</code> is missing the <code>std::</code> qualifier.</p>\n</li>\n<li><p><code>first + ...</code> assumes a random access iterator. It is an unnecessary requirement. A bulk of the code requires bidirectional iterators only. Try to stay with them.</p>\n</li>\n<li><p>Performan...
{ "AcceptedAnswerId": "269895", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T22:09:04.547", "Id": "269890", "Score": "1", "Tags": [ "c++", "algorithm" ], "Title": "A possible implementation of std::rotate" }
269890
<p>I have been working on recreating the WP columns block using server-side rendered blocks.</p> <p>For the base creation of the block structure, I have used <code>@wordpress/create-block --template es5</code>. I believe I have got the overall operation working correctly but I am looking for input on how to improve the...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T00:07:20.120", "Id": "532677", "Score": "0", "body": "Do you know which version of PHP is running on the server(s)?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T08:09:42.283", "Id": "532685", ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T22:09:07.110", "Id": "269891", "Score": "0", "Tags": [ "javascript", "php", "wordpress" ], "Title": "Recreating WP Columns Block - Columns Container Only" }
269891
<p>Brief Background: I just started learning Android Development recently. I have some experience with programming and understand the basics of OOP but am not confident that I am using principles of OOP properly.</p> <p>In the App that I am working on, I am using a Nested RecyclerView. Since posting the code from the A...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-08T22:11:56.473", "Id": "269892", "Score": "1", "Tags": [ "object-oriented", "design-patterns", "android", "classes", "nested" ], "Title": "Android Kotlin: Main Concept: Nest...
269892
<p>This is a Python 3 module that generates random pronounceable word-like strings based on Markov Chains. It has many modes, each mode conforms to the structures of dictionary words to a degree, the two highest conforming modes use Markov Chain trees, with the output of THE highest conforming mode practically indistin...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T04:46:50.090", "Id": "269898", "Score": "2", "Tags": [ "python", "python-3.x", "random", "markov-chain" ], "Title": "Python Markov Chain based pseudoword generator" }
269898
<p>Recently I've started to learn the C programming language. This is my first program which finds zero places of quadratic formulas. Doesn't parse, just gets the discriminants, counts delta and x1, x2.</p> <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;ma...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T20:23:23.460", "Id": "532739", "Score": "4", "body": "While it's great that a review enabled you to improve your code, please do not update the code in your question to incorporate feedback from answers. Doing so goes against the Qu...
[ { "body": "<p>Overall clear and readable. Some remarks:</p>\n<ul>\n<li><p><code>atoi</code> is one of those standard library functions that should <em>never</em> be used. It is 100% equivalent to <code>strtol</code> family of functions, except that the latter have error handling and support for other number bas...
{ "AcceptedAnswerId": null, "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T08:29:17.897", "Id": "269902", "Score": "12", "Tags": [ "beginner", "c", "calculator" ], "Title": "My first C program: quadratic formula calculator code" }
269902
<p><strong>EDIT</strong>: Updated version available here: <a href="https://codereview.stackexchange.com/questions/269950/a-counting-loop-class-v2">A counting loop class v2</a></p> <p>Ranges (C++20) aren't quite ready, so until then, I needed a reliable counting loop class that ​works fairly well to replace the old-styl...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T09:08:46.353", "Id": "532686", "Score": "0", "body": "What's \"not ready\" about the Ranges library? It seems pretty workable to me." } ]
[ { "body": "<p>We currently accept non-numeric types such as other iterators - is that intended?</p>\n<hr />\n<p>I'm not convinced this is a good choice when <code>T</code> is unsigned:</p>\n<blockquote>\n<pre><code> using difference_type=value_type;\n</code></pre>\n</blockquote>\n<p>We probably want to use <...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T08:41:52.060", "Id": "269903", "Score": "0", "Tags": [ "c++", "iterator" ], "Title": "A simple counting loop class" }
269903
<h2>Use case</h2> <p>I have a site that (at peak time) will serve 1000 requests per second. Each request should trigger a record in an SQL Server database table.</p> <h2>Requirements</h2> <ol> <li>The request must not fail, even though the writing to the database could fail.</li> <li>The user should not wait for the wr...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T09:10:09.700", "Id": "269904", "Score": "5", "Tags": [ "c#", "sql-server" ], "Title": "dotnet - creating db records in bulks in a background job" }
269904
<p>I have written this k-means algorithm without using any class structure. The audience of my code are students who are pretty new to Python. Is it possible to review the code so that it is more readable by beginner of Python, and at the same time efficient. I wrote the code quite quickly, without reviewing it properl...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T11:45:21.120", "Id": "269908", "Score": "0", "Tags": [ "python", "performance", "algorithm" ], "Title": "Clarity and optimization of kmeans algorithms" }
269908
<p>Since I am a Unix newbie, I wanted to know if the code reflects the &quot;unix&quot; style and if there is something to add for it to be robust.</p> <p>P. S. I hope I am not overusing <code>assert</code> calls.</p> <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #in...
[]
[ { "body": "<blockquote>\n<p>I hope I am not overusing <code>assert</code> calls</p>\n</blockquote>\n<p>You do. <code>assert</code> is a debugging instrument. If <code>NDEBUG</code> macro is defined, the calls to <code>assert</code> are removed at the compile time. This is a usual practice for the production cod...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T12:06:36.850", "Id": "269909", "Score": "1", "Tags": [ "c", "socket", "tcp", "unix" ], "Title": "Low level tcp socket" }
269909
<p>I am refreshing my C++ programming skills, and I'm currently reading the book C++ 17 by Ivor Horton. The idea is to code some naive implementations of numerical algorithms (Root finding, solving a system of linear equations). To hone my skills, I decided to write a custom C++ <code>Matrix</code> class. This can be a...
[]
[ { "body": "<p>We have a stray <code>typename</code> keyword, that's considered incorrect by GCC 11:</p>\n<pre><code>template &lt;typename scalarType, int rowsAtCompileTime, int colsAtCompileTime&gt;\nclass Matrix&lt;typename scalarType, rowsAtCompileTime, colsAtCompileTime, std::array&lt;scalarType, rowsAtCompi...
{ "AcceptedAnswerId": "269921", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T14:21:05.220", "Id": "269914", "Score": "6", "Tags": [ "c++", "matrix", "mathematics", "c++17" ], "Title": "Writing a C++ Matrix class" }
269914
<p>I wrote a simple neural network binary classification algorithm using Pytorch. It uses the dataset from <a href="https://www.kaggle.com/pritsheta/heart-attack" rel="nofollow noreferrer">https://www.kaggle.com/pritsheta/heart-attack</a>, which consists of a table with 300 rows and 14 columns. The final column, 'targe...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T15:50:04.383", "Id": "269918", "Score": "0", "Tags": [ "python", "machine-learning", "neural-network", "pytorch" ], "Title": "Binary classification with pytorch" }
269918
<p>Let me just say this right off the bat: <strong>If-Else</strong> is often a poor choice. It leads to complicated designs, less readable code, and may be pain inducing to refactor.</p> <p>The objective of this method is to make a panel in green color if the candidate has exceeded a volume and if he has spoken in a no...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T00:17:18.117", "Id": "532757", "Score": "2", "body": "The current question title, which states your concerns about the code, is too general to be useful here. Please [edit] to the site standard, which is for the title to simply stat...
[ { "body": "<blockquote>\n<p>I thought about getting rid of the previous code and using a dictionary</p>\n</blockquote>\n<p>I have no idea how the second snippet is a rewrite of the first snippet. There is no contextual overlap whatsoever. But I'll review both snippets independently.</p>\n<hr />\n<h2>Snippet 2</...
{ "AcceptedAnswerId": "269943", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T15:59:02.420", "Id": "269919", "Score": "0", "Tags": [ "c#" ], "Title": "How to make this more readable with many if else" }
269919
<p>Currently working on a website with the following sorting function, but it's slow and reloads several times when I search for someone; how can I improve its performance? Or, more importantly, which parts of this function are slowing down the search?</p> <pre><code> const getFilteredPeople = ({ people, searchQuery, i...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T23:33:07.967", "Id": "532755", "Score": "1", "body": "Welcome to CR! Showing a complete component would make it easier to help. How large is `people` and what sort of `searchQuery` is causing the performance trouble?" } ]
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T16:21:42.627", "Id": "269920", "Score": "0", "Tags": [ "javascript", "performance", "sorting", "react.js" ], "Title": "React filter-and-search algorithm" }
269920
<p>This was the first time I dipped my toes into Spring Cloud Stream in combination with reactive programming via a reactive WebSocket client.</p> <p>It works in terms of general functionality - A subscriber to the topic receives the message payloads received via the WebSocket client - But I still have problems impleme...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T17:09:08.620", "Id": "269925", "Score": "0", "Tags": [ "kotlin", "spring", "reactive-programming" ], "Title": "Reactive Spring Cloud Stream WebSocket Source Service" }
269925
<p>I'm a developer who has completed almost one year of full-stack development &amp; learning. I published my very first package lately, and I don't know is my code good or bad. So I jumped down here.</p> <p>EditorJS is block based medium-like rich text editor, <a href="https://editorjs.io/" rel="nofollow noreferrer">s...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T18:41:08.030", "Id": "532729", "Score": "0", "body": "Welcome to Code Review! I [changed the title](https://codereview.stackexchange.com/revisions/269929/3) so that it describes what the code does per [site goals](https://codereview...
[ { "body": "<p>Your package builds on the <code>getBlocks()</code> method of EditorJS. You get all blocks, which represent HTML tags and their content, and you render it as HTML output using PHP template files. The ugly code is probably hidden in these templates?</p>\n<p>You have not explained why you would want...
{ "AcceptedAnswerId": "269942", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T18:06:17.897", "Id": "269929", "Score": "2", "Tags": [ "php", "json" ], "Title": "Handling Medium-like text editor output at backend" }
269929
<p>I have never tried this before. Just started with Kotlin and Android CameraX. Here is a fragment I would like some feedback on so I can writer safer and better Kotlin code.</p> <pre><code>package com.name.app.maincontroller import android.Manifest import android.annotation.SuppressLint import android.content.Contex...
[]
[ { "body": "<p>I haven't worked with CameraX, so I'll just point out other things I noticed.</p>\n<hr />\n<p>In this code:</p>\n<pre><code> cameraCaptureButton.setOnClickListener {\n it.isEnabled = false\n if (!isRecording) {\n isRecording = true\n camer...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-09T19:42:19.500", "Id": "269933", "Score": "3", "Tags": [ "android", "kotlin" ], "Title": "Fragment to control and show camera images" }
269933
<p>I have implemented a simple pattern matching for the below algorithm in Java with time complexity of O(n)(n is the size of the input array).</p> <p>Any suggestions for optimization??</p> <p><strong>one of the most important aspects of accurately matching records to candidates is ensuring that the name in the record ...
[]
[ { "body": "<p>your code looks fine - some minor issues:</p>\n<h2>test driven developement</h2>\n<p>if you have clear requirements, write test to validate them.</p>\n<blockquote>\n<p><em>&quot;The method should pass the following tests&quot;</em></p>\n</blockquote>\n<p>i hope you <strong>have these tests</strong...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T03:06:19.403", "Id": "269936", "Score": "3", "Tags": [ "java", "programming-challenge", "pattern-matching" ], "Title": "pattern matching coding challenge" }
269936
<p>I have used the factory pattern for one of my projects. I want to know if this is a good design or if my code can be improved to make it as fast as possible.</p> <p>I am not an expert in C#. This is what I came up with after 2 days of research, with lots of rewrites. What I want to ask is:<br /> Is this the right ap...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T08:05:30.743", "Id": "532781", "Score": "0", "body": "Maybe I abstract generic model class would be more suitable?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T11:44:28.893", "Id": "532799", ...
[ { "body": "<p>I think you have over-engineered the problem. You don't need neither the <code>Factory</code> nor the <code>Factory&lt;T&gt;</code> classes.</p>\n<pre><code>public class Root\n{\n private readonly Dictionary&lt;string, Type&gt; ModelMapping;\n private readonly ConcurrentDictionary&lt;Type, M...
{ "AcceptedAnswerId": "269974", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T07:39:04.130", "Id": "269939", "Score": "0", "Tags": [ "c#", "factory-method" ], "Title": "Factory pattern to build multiple models" }
269939
<p>I am not sure how to accurately describe what this program does in just a few words, anyway this program is very simple and easy to use, what it does is very simple and it is good at it.</p> <p>Let me start from the beginning, I want to generate random pronounceable strings that closely resemble English text, and I ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:09:17.750", "Id": "532884", "Score": "0", "body": "Side note, the third column's label is not a typo, yes it is nonstandard, but I deliberately chose it because the meaning I tried to express through the past participle isn't the...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T08:42:27.283", "Id": "269940", "Score": "2", "Tags": [ "python", "python-3.x", "gui", "pyqt" ], "Title": "Python 3 simple PyQt6 GUI program that helps text processing" }
269940
<p>I am trying to implement the <a href="https://esolangs.org/wiki/Dis" rel="nofollow noreferrer">Dis</a> language as a webpage in order to reproduce Dis programs for <a href="https://codegolf.stackexchange.com">code golfing</a> easily on browser.</p> <p>Since a famous online environment <a href="https://tio.run" rel="...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T13:40:36.210", "Id": "532812", "Score": "0", "body": "Is the code working the way you expect it too?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T14:01:35.443", "Id": "532814", "Score": "0"...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T11:45:29.233", "Id": "269945", "Score": "0", "Tags": [ "javascript", "object-oriented" ], "Title": "Implementing a programming language with objected-oriented programming in EcmaScrip...
269945
<p>So far I have made a class called Deck, to create and shuffle a deck of cards, and a class called Player, which I want to use to create the gambler and the dealer.</p> <p>My Player class inherits from the Deck class, so the players can access the created deck. My problem is that because I create 2 objects from Playe...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T12:28:12.293", "Id": "532803", "Score": "3", "body": "It's wrong to inherit Player from Deck. Inheritance means you can do with children everything you can do with a parent, e.g. if you can shuffle a Deck, then you also should be ab...
[ { "body": "<p>It's a nice Deck class that you've made, but allow me to suggest a few changes:</p>\n<ul>\n<li>Make <code>MinDeckSize</code> and <code>DeckOfCards</code> private, for encapsulation.</li>\n<li>Often the code style is such that types such as classes are in <code>PascalCase</code>, - and variables ar...
{ "AcceptedAnswerId": "269956", "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T11:50:47.020", "Id": "269946", "Score": "1", "Tags": [ "c++", "object-oriented", "game", "playing-cards" ], "Title": "Card deck for Blackjack in an OOP style" }
269946
<p>I want to start omxplayer, check if there is the process is up, check if there is internet connection start with play a streaming, if there is not play a local loop, meanwhile try to check if the internet connection is up, if there is internet connection stop local file and play streaming video. I write this... any ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T21:43:23.670", "Id": "532845", "Score": "0", "body": "If `miamail@mia.com` is a real email address, then I suggest to redact it." } ]
[ { "body": "<h3>Use indentation to make the flow of logic easier to see</h3>\n<p>With indentation added to the original code,\nit's a lot easier to understand the branches of the logic:</p>\n<pre><code>killall -9 omxplayer.bin\nSERVICE='omxplayer'\nwhile true; do\n if ps ax | grep -v grep | grep $SERVICE &gt;...
{ "AcceptedAnswerId": "269964", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T12:07:53.493", "Id": "269947", "Score": "0", "Tags": [ "bash", "raspberry-pi" ], "Title": "bash loop for checking service and network connection" }
269947
<p>I wrote a Lagrange polynomial interpolation class. It works fine. At the beginning some definitions: <span class="math-container">$$ \begin{align} &amp;nodes:\qquad x_0, \dots, x_n \\ &amp;values:\qquad f(x_0), \dots, f(x_n) \\ &amp;weights:\qquad w_0, \dots, w_n\qquad\text{where}~~~ w_j = \prod_{k=0, k \neq j}^{n}(...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T15:06:57.327", "Id": "532823", "Score": "0", "body": "Could someone edit my post and change coeff to \\text{coeff} (and other) in align enviroment? Unfortunately I can't do this...." } ]
[ { "body": "<h1>binary_search_find_index</h1>\n<p>I'm not sure why you are using different template types for the <code>vector</code> and <code>data</code>.</p>\n<p>It looks like you are trying to find the index of the <b>closest</b> element in the vector but then you discard it if it's not exactly equal to <cod...
{ "AcceptedAnswerId": "269951", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T13:54:36.190", "Id": "269949", "Score": "2", "Tags": [ "c++", "object-oriented", "mathematics", "c++14" ], "Title": "Simple Lagrange interpolation" }
269949
<p>Rewrite of <a href="https://codereview.stackexchange.com/questions/269903/a-simple-counting-loop-class/269912#269912">A simple counting loop class</a> based on feedback:</p> <p>This version adds a step parameter and better iterator concept support. Counting is always done in a signed integral, and only integers and ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T14:28:39.557", "Id": "532816", "Score": "0", "body": "Available here: https://godbolt.org/z/Px3nfYqPx" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T15:01:38.953", "Id": "532822", "Score": "1...
[ { "body": "<h1>Incorrect pointer types</h1>\n<p>When the value type of a range is <code>T</code>, then the following member types look wrong:</p>\n<pre><code>using pointer=T;\nusing reference=T;\n</code></pre>\n<p>A range like this doesn't point to actual objects, so pointers don't make sense. Remove them, and ...
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T14:25:36.523", "Id": "269950", "Score": "3", "Tags": [ "c++", "iterator", "c++20" ], "Title": "A counting loop class v2" }
269950
<p>In my python-based project I have the following problem: I have a list with many entries, with each entry being an object of the same class. This is demonstrated in the code below:</p> <pre><code>#!/usr/bin/env python3 class demo_class: &quot;&quot;&quot;Example class for demonstration&quot;&quot;&quot; def...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T16:06:59.423", "Id": "532825", "Score": "3", "body": "Hey I'm afraid this is too hypothetical to be reviewed? You might need list comprehensions, maybe? Can't say without the complete code." }, { "ContentLicense": "CC BY-SA ...
[ { "body": "<p>As best I can tell — based more on your code's behavior than your description of it — you have some objects and you want to print them all in an\norder based on their attribute values. If so, a <a href=\"https://docs.python.org/3/library/dataclasses.html\" rel=\"nofollow noreferrer\">dataclass</a>...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T15:36:26.133", "Id": "269953", "Score": "-1", "Tags": [ "python" ], "Title": "Getting all elements in list with certain attribute value in python - Improved solution compared to loop" }
269953
<p>I coded a little loop that reduces a dataset by computing the mean of X rows every X rows. <br>I'm working with a dataset of a certain size (8 Millions rows for 10 columns) and my code takes too long to compute the whole dataset.<br> I am using Pandas.<br> Is there a way to improve my loop to make it more efficient ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T03:11:13.710", "Id": "532941", "Score": "0", "body": "Is one of those \"x rows\" in the top row supposed to be something else? Otherwise, I think youve pretty much got it covered... : ) 3 out of 3 ain't bad; it's perfect! ...sry, ...
[ { "body": "<p>Your current code breaks two major pandas antipatterns, explained in depth by <a href=\"https://stackoverflow.com/users/4909087/cs95\">@cs95</a>:</p>\n<ul>\n<li><a href=\"https://stackoverflow.com/a/55557758/13138364\">Avoid iterating a DataFrame</a></li>\n<li><a href=\"https://stackoverflow.com/a...
{ "AcceptedAnswerId": "270003", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T19:05:06.057", "Id": "269957", "Score": "2", "Tags": [ "python", "pandas" ], "Title": "Compute the mean of every X rows of a pandas DataFrame" }
269957
<p>I use asyncio to speed up web scraping. I collect only title, author, tags, datetime, total comments from list view from specific <a href="https://unboxholics.com/news" rel="nofollow noreferrer">website</a>. Also, i collect these from all pages. I would like to improve my code, so any idea i would appreciate it.</p>...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T21:31:35.673", "Id": "269961", "Score": "2", "Tags": [ "python", "python-3.x", "web-scraping", "beautifulsoup", "asyncio" ], "Title": "Web scraping articles using asyncio"...
269961
<p>I'm a computer science student, and in 2 of my courses this semester we are writing short C programs to demonstrate the things we are learning about. All of these programs require command-line flags &amp; arguments, so I decided to write a short single-header library for myself to be able to add simple flags, intege...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T22:02:37.980", "Id": "269963", "Score": "2", "Tags": [ "c", "console", "macros", "c-preprocessor" ], "Title": "Implement easy CLI options in C using a single-file header" }
269963
<p>I've just started learning rust and have written a basic sudoku solver, however it seems to run much slower than I expected. So I'm looking for any possible performance improvements as well as any other general feedback.</p> <pre class="lang-rust prettyprint-override"><code>fn main() { let initial_grid: [[i8; 9]...
[]
[ { "body": "<h2>Goal</h2>\n<p>The goal is to optimize the program. I won't change the backtracking algorithm.</p>\n<h2>General feedback</h2>\n<p>Your code is good, but you should use structs and impls in this program, instead of passing <code>grid: [[i8; 9]; 9]</code> around. I show this in code below.</p>\n<h2>...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-10T23:44:47.737", "Id": "269967", "Score": "4", "Tags": [ "performance", "beginner", "rust", "sudoku", "backtracking" ], "Title": "Rust based Sudoku solver using backtracking...
269967
<p>I did research because I want to learn Kruskal's and Prim's MSTs. I did research and after a solid understanding, I went to my textbook and got their libraries:</p> <ul> <li><p><a href="https://algs4.cs.princeton.edu/code/edu/princeton/cs/algs4/Edge.java.html" rel="nofollow noreferrer">https://algs4.cs.princeton.edu...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T05:23:18.377", "Id": "532865", "Score": "0", "body": "\"No MST exists!\" - is it possible?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T19:29:35.847", "Id": "532914", "Score": "0", "bod...
[ { "body": "<p>Seeing you hyperlinked Princeton <em>Algorithms, 4th Ed.</em> resources, I assume you know how to view their take of Prim's.<br />\nI do not understand your concern about <em>terse</em>ness.</p>\n<p>There is one striking difference between the code you present for review and that of <code>edu.prin...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T02:36:05.870", "Id": "269968", "Score": "-1", "Tags": [ "java", "algorithm", "tree", "graph" ], "Title": "is my Prim's MST implementation terse enough?" }
269968
<p>I import a list of objects from an JSON file and want to display it in a WPF TreeView Control. The Data looks like this:</p> <pre><code> [ { &quot;Name&quot;: &quot;Name1&quot;, &quot;Ip&quot;: &quot;192.168.1.1&quot;, &quot;Location&quot;: &quot;LocA&quot;, &quot;Group&quot;: &quot;GrpB&quot;, ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-10-21T13:56:33.843", "Id": "532873", "Score": "0", "body": "Personally i'd use a `TreeNode : ITreeNode` and `ITreeNode : IList<ITreeNode`, then a node could be an `IServer`, i.e. create an abstract tree in which you could do `OfType<T>` a...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-10-21T13:15:44.233", "Id": "269971", "Score": "0", "Tags": [ "c#", "wpf" ], "Title": "Sort Data in Categories to display in Treeview" }
269971
<p>I'm trying to learn and write best practice unittests and practice test driven design. Can you give me some tips and review my code?</p> <pre><code>using System.Threading.Tasks; using Moq; using Xunit; namespace Blockchain.Unittests { public class AccountShould { private static string _webUrl = &quo...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:41:49.033", "Id": "532888", "Score": "0", "body": "In your test you are testing moq :)" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:45:41.067", "Id": "532890", "Score": "0", "body...
[ { "body": "<p>Your <code>GetBalanceInEth</code> is a wrapper around the <code>GetAccountBalanceInEth</code> call. That's why you can't test too much things.</p>\n<p>But this here are my advices:</p>\n<ul>\n<li>Rename your test to follow the <code>Given-When-Then</code> pattern</li>\n<li>Preserve <code>4</code> ...
{ "AcceptedAnswerId": "270014", "CommentCount": "10", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T10:18:42.320", "Id": "269972", "Score": "1", "Tags": [ "c#", ".net", "xunit" ], "Title": "Unittesting in .NET 6 with XUnit" }
269972
<p>I am extracting/processing some data from a netCDF file. It is the first time I am processing the netCDF file. The data processing is super slow, and I would like to learn how to speed up the process.</p> <p>Following is the code:</p> <pre><code>import numpy as np from netCDF4 import Dataset deltaLambdaI = float(i...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:15:08.440", "Id": "269975", "Score": "0", "Tags": [ "performance", "python-3.x" ], "Title": "Optimizing data processing of netCDF file" }
269975
<p>I'm taking a course and I've just completed a challenge. The program runs well and it does everything I told it to, but I would like suggestions as to what can I implement to make it better (ex. pointers, move constructors etc.).</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;string&gt...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:44:50.837", "Id": "532889", "Score": "1", "body": "If this is a programming challenge, please quote the text of the challenge itself in the question, add a link to the programming challenge and provided any example input and outp...
[ { "body": "<p><a href=\"https://stackoverflow.com/questions/1452721\">Don’t</a> write <code>using namespace std;</code>.</p>\n<p>You can, however, in a CPP file (not H file) or inside a function put individual <code>using std::string;</code> etc. (See <a href=\"https://github.com/isocpp/CppCoreGuidelines/blob/...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T13:20:01.930", "Id": "269976", "Score": "0", "Tags": [ "c++", "performance" ], "Title": "What do you think about my program and what can I implement to make it more efficient? (ex. ru...
269976
<p>I'm learning C++ by implementing a previous project I did in Python. This is a simple stack machine which evaluates mathematical expressions, e.g. pow(9, 12). The code to run this on the stack machine would be an ordered list of constants and instructions: 12 9 POW.</p> <p>In Python, preparing such a list is quite ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T17:36:18.820", "Id": "532907", "Score": "0", "body": "Is your `main()` supposed to be double-spaced like that, or is it a problem of how you copied the code into your question?" }, { "ContentLicense": "CC BY-SA 4.0", "Cr...
[ { "body": "<p>Here is what I would recommend doing:</p>\n<ol>\n<li>Create an <code>enum class</code> called <code>Operation</code> (or something of that sort) with its values being all of the different operator names (POW, ABS, etc.) Info on <code>enum class</code> <a href=\"https://en.cppreference.com/w/cpp/la...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T16:34:19.607", "Id": "269983", "Score": "3", "Tags": [ "c++", "performance", "stack" ], "Title": "Passing Programs To A Stack Machine Implemented In C++" }
269983
<p>I am creating an alert system for a game/sim in C# that keeps track of negative actions performed by the user during a training exercise. There are preconfigured alerts that have data, such as UI text and how many times the alert may be triggered before the user fails the exercise. Whenever an alert is triggered, th...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T17:08:16.877", "Id": "269985", "Score": "1", "Tags": [ "c#", "design-patterns" ], "Title": "Alert system for game or simulator" }
269985
<p>I'm learning about OOP and putting my knowledge into practice. I created a login system in PHP, so I wish someone could tell me if I'm on the right track. I feel like I'm getting better at coding, but it's never good enough, so I want someone more experienced (especially in OOP) to look at my code and tell me if I'm...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T20:39:50.037", "Id": "532919", "Score": "0", "body": "The question I'd ask you is why do you want to use OOP? Just because you read about something doesn't mean it's a good idea. I would think about what exactly you're trying to ach...
[ { "body": "<p>This is a pretty good attempt at a login system. The code looks much better than 99% of code that I see on Stack Overflow. Keep up the good work!</p>\n<p>Your code is almost clean. Your classes do so little that I would consider it too little (more on this later). The naming is almost perfect IMHO...
{ "AcceptedAnswerId": "269997", "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T19:02:41.590", "Id": "269987", "Score": "10", "Tags": [ "php", "object-oriented", "authentication" ], "Title": "Is my PHP login system following best practices? Is the code re...
269987
<p>I have an Enum the encapsulates numeric primitives (u8, i8, u16, i16, u32, i32, u64, i64, f32, f64) into a common type called &quot;Number&quot;. I want to implement a PartialOrd train for the enum based on the encapsulated data allowing different numbers to be compared. I have a solution that uses nested pattern ...
[]
[ { "body": "<p>You can match on a tuple, which flattens everything:</p>\n<pre><code>impl PartialOrd for Number {\n fn partial_cmp(&amp;self, other: &amp;Self) -&gt; Option&lt;Ordering&gt; {\n match (self, other) {\n (Number::U8(x), Number::U8(y)) =&gt; (*x).partial_cmp(y),\n (Numb...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T19:44:57.960", "Id": "269990", "Score": "1", "Tags": [ "rust", "enum", "pattern-matching" ], "Title": "PartialOrd of Rust Enums based on encapsulated data" }
269990
<p>In this program I've tried the insertion Sort method to execute</p> <pre><code>#include&lt;stdio.h&gt; int main() { int numbers[25]={21,89,98,76,56,4,345,34,53,56,68,68,68,575,7,4,45,45,35,35,35,2,22,52,235}, temp_str, comp_count=0 ; while(comp_count&lt;25) // To ensure sorting completion { for(...
[]
[ { "body": "<p>First thoughts: all the code is in <code>main()</code>, but we would like to have a reusable function. I'd create a function that accepts an array and its length:</p>\n<pre><code>void insertion_sort(int arr[], size_t len)\n</code></pre>\n<hr />\n<p>Here is a good demonstration of why <em>one decl...
{ "AcceptedAnswerId": "270009", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-11T20:25:18.600", "Id": "269991", "Score": "1", "Tags": [ "c", "insertion-sort" ], "Title": "Sorting numbers using Insertion method" }
269991
<p>My solution for the leet code problem to search an array of ints for duplicate values and return a boolean seems quite efficient (&lt; 90% of submissions runtime). However, I am currently reviewing Data Structures and Algorithms and I wonder if there is a more efficient approach to this, since if my counting is corr...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T07:24:56.597", "Id": "532948", "Score": "0", "body": "are you sure it's `O(n)` ? because the `Contains` has an iterator as well which puts it `O(n^2)`" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T0...
[ { "body": "<p>This can be slightly optimized by not using <code>Contains()</code> but checking the returned value from <code>Add()</code>. If the item is allready contained in the <code>HashSet&lt;T&gt;</code> calling <code>Add()</code> will return <code>false</code>.</p>\n<pre><code>public bool ContainsDuplica...
{ "AcceptedAnswerId": "270012", "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T00:05:53.633", "Id": "270002", "Score": "4", "Tags": [ "c#", "algorithm", "programming-challenge" ], "Title": "Determine whether an array contains duplicate values" }
270002
<p>I'm new to C#. I have created a form that has 5 text boxes and this function checks to see if every text box has text in the box. If not, then it displays a message box saying &quot;Error (Add Text)&quot;.</p> <p>I wanted to see if there was a way to simplify this, or if this is the best way of completing this ta...
[]
[ { "body": "<p>you can use <code>Dictionary</code> to store the <code>TextBox</code>s and their representive name, then just iterate over them, something like this :</p>\n<pre><code>private bool ValidInput()\n{\n Dictionary&lt;string, TextBox&gt; textBoxes = new Dictionary&lt;string, TextBox&gt;\n {\n ...
{ "AcceptedAnswerId": "270122", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T08:02:57.413", "Id": "270005", "Score": "1", "Tags": [ "c#", "beginner", "winforms" ], "Title": "Verify that 5 Textboxes have some content" }
270005
<p>I begin a simple app who manipulates a deck of playing card here is my first attempt at modeling it, what do you think ? What could be a potential caveat for the future with that model ?</p> <p>Thanks :)</p> <pre><code>const ALL_VALUES = [1,2,3,4,5,6,7,8,9,10,11,12,13] as const; type ValueTuple = typeof ALL_VALUES; ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T12:10:25.933", "Id": "532975", "Score": "0", "body": "You shouldn't use a type assertion to force a value to a const" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T22:45:56.573", "Id": "533019", ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T11:47:34.270", "Id": "270010", "Score": "0", "Tags": [ "typescript" ], "Title": "Simple Deck of playing cards in typescript" }
270010
<p>I'm working with an API that for some strange reason returns star ratings as words, like <code>FIVE,FOUR,THREE,TWO,ONE</code>. As far as I can see, there's no way to just get the numerical rating, so I have to locally convert these into numbers.</p> <p>I went with a <code>switch</code> statement, but honestly whenev...
[]
[ { "body": "<p>I'm not a Javascript programmer, but it looks strange that we return a different <em>type</em> of result for the <code>default</code> case. Can't we return a number (e.g. <code>0</code>)? Or a NaN? Or perhaps even throw an exception.</p>\n<p>I guess that without more context of how the function ...
{ "AcceptedAnswerId": "270021", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T15:31:31.657", "Id": "270016", "Score": "3", "Tags": [ "javascript", "parsing", "converting" ], "Title": "Convert number 1-5 from its spelt-out form" }
270016
<p><strong>What the program does:</strong> I have made a program that simulates a ball in an area made of triangles and many optimizations because it's for high-performance ball path simulation (technically ball path prediction).</p> <p><strong>Vec3 and Ball definitions:</strong></p> <pre class="lang-rust prettyprint-o...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T19:35:56.833", "Id": "533000", "Score": "1", "body": "There isn't enough information here to determine “most efficient”. We'll need to see the definition of `Ball` at least; preferably a complete runnable program. It's very likely t...
[ { "body": "<p>welcome to the Rust community.</p>\n<p>A Vec is a continuous slice of heap memory. A Box is a fixed-size portion of heap memory (except for boxed DSTs). A Box within a Vec is entirely unnecessary (except in extreme cases when you are moving around huge structs). Putting a Box inside a Vec is like...
{ "AcceptedAnswerId": "270465", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T16:35:33.963", "Id": "270019", "Score": "1", "Tags": [ "rust", "simulation" ], "Title": "Quickly update, clone, and iterate ball simulation" }
270019
<p>I got this HW question from my freshman year at college - &quot;Create a python function to check whether a string containing only lowercase letters has any repetition in it&quot;.</p> <p>So, I did it a few ways:</p> <ol> <li><p>Brute forced it by checking if a character in the string was present in the substring to...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T10:46:04.313", "Id": "533105", "Score": "7", "body": "\"I create a unique Mersenne prime number\". No you don't. ;) It's a creative idea, though." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T03:29:...
[ { "body": "<p>You should use <a href=\"https://docs.python.org/3/tutorial/datastructures.html#sets\" rel=\"noreferrer\">sets</a> which are an unordered collection <em>without duplicates</em>. Sets are <a href=\"https://en.wikipedia.org/wiki/Set_(abstract_data_type)\" rel=\"noreferrer\">a fundamental data struct...
{ "AcceptedAnswerId": "270024", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T17:11:10.397", "Id": "270022", "Score": "15", "Tags": [ "python", "python-3.x" ], "Title": "Check whether a lowercase string has any character repetition" }
270022
<p>In my .net core hosted service console application, I am reading a database table, retrieving some values, and based on a status, I am sending emails. It is working as it is expected, I wonder if there are any improvements to make it better. So I would be glad if you can share your comments.</p> <p>Thanks in advance...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T17:15:15.093", "Id": "270023", "Score": "0", "Tags": [ "c#", ".net-core" ], "Title": "Sending emails from .net core console hostedservice" }
270023
<p>The problem: I am working with a set of objects in Blender with per-vertex colours. Each object has only two distinct colours. For all objects in a selection, I am choosing only the brighter of those two colours, and increasing its brightness by 10%.</p> <p>Language: Python 3.7</p> <p>About me: I am new to coding in...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T20:45:10.793", "Id": "270028", "Score": "2", "Tags": [ "python", "beginner", "python-3.x" ], "Title": "Make selected colours brighter in Blender" }
270028
<p>I made a general smart pointer which fixes the problems of loops between <code>std::shared_ptr</code>'s. While use is simple, I feel that my code is inefficient and clumsy. Here it is:</p> <pre><code>/* * gc.hpp * * Created on: Nov 10, 2021 * Author: lambcoder */ #ifndef GC_HPP_ #define GC_HPP_ #include &...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T21:57:45.307", "Id": "533017", "Score": "0", "body": "What happens if a loop is unreachable? Because whichever you destroy first, the rest may stumble over." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-1...
[ { "body": "<p>First, we need to fix the errors.</p>\n<ul>\n<li>The most obvious one is that the <code>#ifndef GC_HPP_</code> has no matching <code>#endif</code>.</li>\n<li>We're missing an include of <code>&lt;cstdint&gt;</code> for the fixed-width integer types.</li>\n<li>We're missing <code>&lt;utility&gt;</c...
{ "AcceptedAnswerId": "270043", "CommentCount": "9", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T20:47:46.520", "Id": "270029", "Score": "5", "Tags": [ "c++", "memory-management", "c++17", "pointers" ], "Title": "C++ Garbage Collector - Simple Automatic Memory Managem...
270029
<p>I am currently working on a Connect 4 game for a project and it works. We added support so that it can be played by 3 players instead of 2. I know there is multiple instances of repeated code or un-optimized functions or code. I would appreciate any help on that front.</p> <p>Regarding the 3 player connect 4 we pret...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T18:57:20.953", "Id": "533074", "Score": "0", "body": "At least for me, your code isn't working (Python 3.9.4 on MacOS). It prints out some pygame boilerplate and a grid of zeros to the terminal and opens up a pygame window, but the ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T21:02:36.090", "Id": "270031", "Score": "2", "Tags": [ "python", "pygame", "connect-four" ], "Title": "Connect 4 project for three players with PyGame graphics" }
270031
<p>I want to apply an async function to items retrieved through a stream.<br /> I have found two ways of doing it:</p> <p>Code 1</p> <pre><code>const promises = []; await new Promise(resolve =&gt; { const stream = getStream(); stream.on(&quot;data&quot;, (item) =&gt; { promises.push(handle(item)); }); stream.on(...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T23:48:19.100", "Id": "533021", "Score": "1", "body": "Code 2 won't run as shown because the second `await` is not inside an `async` function." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T21:23:00.6...
[]
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-12T23:22:42.197", "Id": "270034", "Score": "0", "Tags": [ "node.js", "async-await", "stream" ], "Title": "Async action on each items from a stream" }
270034
<p>This is a C# program that is a reference implementation, it will be used to make a C version after it is stable and bug free. The programs are supposed to simulate sensor data collection and processing nodes. One node gathers data from a sensor, then distributes the data to all the connected clients. The data gather...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T03:29:08.950", "Id": "533026", "Score": "0", "body": "For testing clients I put copies of the client program in multiple folders and changed the `ProcessTime` variable to different values." }, { "ContentLicense": "CC BY-SA 4...
[ { "body": "<p>The code looks good as far as I can tell.</p>\n<p>Just a few functional observations.</p>\n<p>I obviously have no clue how the system will operate in real life, but I think the idea of hardcoding the number of clients is a bit odd. I assume that it will go into some sort of limping mode if say onl...
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T03:22:32.287", "Id": "270038", "Score": "1", "Tags": [ "c#", "thread-safety", "socket" ], "Title": "Time-Sensitive Synchronized Transfer of Data Buffer in C# to Multiple Clients" ...
270038
<p>This is my first project in C and I wanted a more experienced person's insight on how I made the whole program. Just looking for feedback it works how I want it to. The Github is <a href="https://github.com/cobb208/logfindAssignment" rel="nofollow noreferrer">here</a>. Thank you so much for the feedback!</p> <pre><c...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T10:36:18.373", "Id": "533037", "Score": "1", "body": "Some things are missing from this question. First, what is this code supposed to *do*, and what do the program arguments mean? Secondly, what's in `\"dbg.h\"`? It would be ver...
[ { "body": "<h1>Pick a style</h1>\n<p>You write:</p>\n<pre><code>int get_file_char_count(FILE *f, char *filename);\nint searchForKeyword(char *keyword, char *check_string);\n</code></pre>\n<p>You are mixing <code>snake_case</code> with <code>camelCase</code> names for your functions. I suggest that you stick wit...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T04:53:42.247", "Id": "270040", "Score": "2", "Tags": [ "c", "programming-challenge", "functional-programming" ], "Title": "Finds Keywords in Log Files" }
270040
<p>I am new to react, I tried to build login form and Code is as follows:</p> <p><strong>LoginForm.js</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>import React fro...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T10:38:12.267", "Id": "533038", "Score": "3", "body": "Welcome to Code Review! We need to know *what the code is intended to achieve*. To help reviewers give you better answers, please add sufficient context to your question, includi...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T10:20:52.447", "Id": "270041", "Score": "0", "Tags": [ "javascript", "react.js" ], "Title": "Refactoring the login form in React based on some rules" }
270041
<p>I know the vectors that describe two lines, <span class="math-container">$$\mathbf{a} + \lambda\mathbf{d}$$</span> and <span class="math-container">$$\mathbf{b} + \mu\mathbf{d'}$$</span> I've written a JavaScript function to get the coordinates of the point of intersection of two such lines. It is guaranteed that th...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T08:27:51.077", "Id": "533251", "Score": "0", "body": "Just make sure your code does not lie ;) If your function only solves for perpendicular lines then that should be reflected in the function name or there should at least be a com...
[ { "body": "<p>If the lines are truly perpendicular then you don't need <strong>d_</strong> since it is either <code>[dy, -dx]</code> or <code>[-dy, dx]</code>.</p>\n<p>If I choose the first one and replace <strong>d_x</strong> by <strong>-dy</strong> and <strong>d_y</strong> by <strong>dx</strong> and substitub...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T13:37:20.443", "Id": "270045", "Score": "2", "Tags": [ "javascript", "mathematics", "vectors" ], "Title": "Intersection of 2D vector equation straight lines" }
270045
<p>I am trying to fetch data from 7000 URLs and save the scrapped info into csv. Rather then go through all the 7000 URLs and save into one file. how can I break the csv into several files. for example 1000 URLs per csv.</p> <p>Below is an example of my current code. I have change the total to index 7000 = 20 and per c...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T15:36:36.517", "Id": "533131", "Score": "0", "body": "Welcome to the Code Review Community. We only review code that is working as expected, there are other sites that will help you debug your code. We do not help you write new code...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T16:22:50.490", "Id": "270049", "Score": "-3", "Tags": [ "python", "beautifulsoup" ], "Title": "Python Loop - Output divide into several files" }
270049
<p>In a previous question that I asked: <a href="https://codereview.stackexchange.com/questions/269644/get-image-value-total">Get image value total</a>, I learned to use <a href="https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.lockbits?view=windowsdesktop-5.0" rel="nofollow noreferrer">LockBits</a> to...
[]
[ { "body": "<p>The following helper class should be useful if you need to compare images:</p>\n<pre><code>class LockedBitmap : IDisposable\n{\n public LockedBitmap(Bitmap image)\n {\n bmp = image;\n rect = new Rectangle(0, 0, image.Width, image.Height);\n bmpData = image.LockBits(rect,...
{ "AcceptedAnswerId": "270089", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-13T20:00:15.510", "Id": "270052", "Score": "1", "Tags": [ "c#", "algorithm" ], "Title": "Getting the total image value" }
270052
<p>I am currently working on a problem that involves multiple producers and a single consumer through a queue object. The following list is about a few things that's special about this problem:</p> <ol> <li>One producer is conditional, meaning that it only produces data to the queue under certain condition.</li> <li>I'...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T09:46:24.700", "Id": "533102", "Score": "1", "body": "The current question title, which states your concerns about the code, is too general to be useful here. Please [edit] to the site standard, which is for the title to simply stat...
[]
{ "AcceptedAnswerId": null, "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T02:14:21.680", "Id": "270056", "Score": "1", "Tags": [ "python", "multithreading", "queue" ], "Title": "Multi-producer/single-consumer queue in Python" }
270056
<p>This is my solution for evaluating postfix expression using a stack. It does work on multidigit numbers, the problem I was struggling with last time. Now it works completely fine.</p> <p>This is the stack that I'm using:</p> <pre><code>class Stack: def __init__(self): self.items = [] def isEmpty...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T13:50:46.047", "Id": "533121", "Score": "0", "body": "isn't `index_of_element` actually `value_at_index`?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T13:54:04.073", "Id": "533122", "Score"...
[ { "body": "<ul>\n<li><p>Python's lists are stacks.<br />\nYour <code>Stack</code> class is making your code harder to read because it's not using Python's idioms.</p>\n</li>\n<li><p>Don't use bare excepts, as all exceptions are silenced.<br />\nYou shouldn't be silencing <a href=\"https://docs.python.org/3/libr...
{ "AcceptedAnswerId": "270066", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T12:47:49.600", "Id": "270063", "Score": "2", "Tags": [ "python", "python-3.x", "object-oriented", "stack", "postfix" ], "Title": "Evaluating postfix expression on mult...
270063
<p>I am trying to use Java8 for a piece of code which I had written in Java6 and am able to achieve the result using both the version of java but I am thinking there could be more better way to write the code which I written in Java8</p> <pre><code>// Find vowels count in each given country names // return map of count...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T05:18:08.357", "Id": "533170", "Score": "1", "body": "Since we are in code review, it is necessary to remind that the definition of a vowel varies from language to language. It seems that you are working with english language, so it...
[ { "body": "<p>Welcome to Stack Review, the first thing I see in the code is the following:</p>\n<pre><code>List&lt;String&gt; VOWELS = Arrays.asList(&quot;a&quot;, &quot;e&quot;, &quot;i&quot;, &quot;o&quot;, &quot;u&quot;);\n</code></pre>\n<p>This is correct, but from the uppercase <code>VOWELS</code> name you...
{ "AcceptedAnswerId": "270073", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T13:09:47.420", "Id": "270064", "Score": "4", "Tags": [ "java", "stream" ], "Title": "Find vowels count in each given country names using Java6 and Java8" }
270064
<p>This was inspired by the question <a href="https://codereview.stackexchange.com/questions/269983/passing-programs-to-a-stack-machine-implemented-in-c">Passing Programs To A Stack Machine Implemented In C++</a>.</p> <p>I wanted to make it a bit smarter by adding control functions:</p> <div class="s-table-container"> ...
[]
[ { "body": "<h2>Security / error handling:</h2>\n<p>I don't think it's a good idea to allow the user to crash the program, or (worse) achieve undefined behavior when running the interpreter. This means we have to check that stack indices are valid before we use them, that we don't try to pop from an empty stack,...
{ "AcceptedAnswerId": "270076", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T13:10:57.793", "Id": "270065", "Score": "3", "Tags": [ "c++", "performance", "virtual-machine" ], "Title": "Simple stack based interpreter" }
270065
<p><code>wordify_number</code> is the main function. A lot of passes are being done over the list (rev, do something, rev again). Is there a way I can improve this?</p> <pre class="lang-ml prettyprint-override"><code>open Base ;; let named_numbers = [| &quot;zero&quot; ; &quot;one&quot; ; &quot;two&quot; ; &quot;thr...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T15:00:48.763", "Id": "270067", "Score": "0", "Tags": [ "ocaml" ], "Title": "A program to convert a number to words written in OCaml. Can I accomplish the same result with less number of p...
270067
<p>In my .net core console application, I am reading a mail inbox and saving excel attachments from a specific sender that has a specific subject. It is working as is expected, I wonder if there are any improvements to make it better. So I would be glad if you can share your comments.</p> <p>Thanks in advance.</p> <pre...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T21:11:13.800", "Id": "533151", "Score": "0", "body": "Do you want your code to be compacted?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T07:31:55.427", "Id": "533173", "Score": "0", "b...
[ { "body": "<p>Maintainability can mean different things for different developers. Here I will use <a href=\"https://www.brcline.com/blog/5-tips-write-maintainable-code\" rel=\"nofollow noreferrer\">this website</a>'s definition:</p>\n<blockquote>\n<p>Maintainable code is basically<br />\nthe amount of time it t...
{ "AcceptedAnswerId": "270093", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T15:10:52.767", "Id": "270068", "Score": "1", "Tags": [ "c#", ".net-core" ], "Title": "Reading inbox from a specific sender and for a specific subject in order to save excel attach...
270068
<p><strong>Main Questions:</strong></p> <ul> <li>Is my runtime analysis correct?</li> <li>Is my approach optimal or close to it?</li> <li>Is there a better way and/or improvements?</li> </ul> <p><strong>Objective:</strong></p> <ul> <li>Write an algorithm to assign <code>n</code> jobs to <code>k</code> entities (servers...
[]
[ { "body": "<p>Your runtime analysis seems fine and your heap-based approach is optimal in the\nnarrow sense that it achieves <code>O(n log n)</code> performance. However, the software\nitself is needlessly complex.</p>\n<p>The path to simplicity is found by remembering the most famous <code>O(n log n)</code>\no...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T16:19:29.760", "Id": "270071", "Score": "0", "Tags": [ "python", "algorithm", "heap", "priority-queue" ], "Title": "Assigning Tasks to Entities (or some other entity) based on...
270071
<p>I'm a Python newbie and I made this GUI dictionary using PyDictionary module, it took me long though, I can sense that the if conditions are really unpractical and ugly, but I couldn't find a way to shorten that part of the code, any recommendations will be highly appreciated.</p> <pre><code>from tkinter import * fr...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T07:37:17.270", "Id": "533246", "Score": "0", "body": "The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to **simply sta...
[ { "body": "<p>Sure; you've got the right idea. Start by writing the code as repetitively as possible, then factor out the repetitive bits. Your first three lines are of the form</p>\n<pre><code>if partOfSpeech in definition[word]:\n label = &quot;{}: &quot;.format(partOfSpeech) + definition[word][partOfSpeec...
{ "AcceptedAnswerId": "270088", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T21:06:01.487", "Id": "270080", "Score": "-1", "Tags": [ "python", "tkinter" ], "Title": "How possible it is to shorten repetitive if-statements in Python?" }
270080
<p>I have a survey response dataframe for which each survey has a <code>code</code>:</p> <p><code>df</code></p> <pre><code> code item_stamp question_name question_type scorable_question subquestion_name stage products_stamp product_ID answer_name respondent_id answers_identity answer T...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-27T17:34:58.157", "Id": "534092", "Score": "0", "body": "Did my suggestion work for you?" } ]
[ { "body": "<p>Iterating over the rows of a data frame is usually very slow.\nFor combining the values of two data frames you can instead use <a href=\"https://pandas.pydata.org/docs/reference/api/pandas.merge.html\" rel=\"nofollow noreferrer\">pandas.merge</a> like this</p>\n<pre><code>import pandas as pd\ncols...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T22:52:51.110", "Id": "270081", "Score": "0", "Tags": [ "python", "performance", "python-3.x", "pandas" ], "Title": "How to speed up the search for matching values in a second ...
270081
<p>(reposted from another forum, <a href="https://artofproblemsolving.com/community/c163h2712829_python_table_improvements" rel="nofollow noreferrer">AoPS</a>)</p> <p>I have made a &quot;Table&quot; data structure with fast mean, median, and mode calculations. To my knowledge there's no built-in function that does this...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T17:55:02.837", "Id": "533280", "Score": "0", "body": "Is there a reason why you are not using `@property` and `@set.property`? See https://stackoverflow.com/questions/2627002/whats-the-pythonic-way-to-use-getters-and-setters. Also t...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-14T23:46:51.453", "Id": "270083", "Score": "0", "Tags": [ "python-3.x" ], "Title": "Python 3 Table Improvements" }
270083
<p>I've completed this as part of an online programming course (in which code review is supposed to be done by fellow learners, but it's been a very long time and none of them have reviewed this), and here are the specifics:</p> <blockquote> <p>Prompt</p> <p>Use a struct to define a card as an enumerated member that is...
[]
[ { "body": "<p>We start off reasonably well, defining some constants:</p>\n<blockquote>\n<pre><code>#define DECK_SIZE 52 //to be used to randomly select each of 52 cards\n#define SUITS_PLUS_ONE 5 //to be used to generate any of the 4 suits\n#define PIPS_PLUS_ONE 14 //to be used to generate any of the 13...
{ "AcceptedAnswerId": "270092", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T02:12:29.427", "Id": "270084", "Score": "3", "Tags": [ "beginner", "c", "homework", "playing-cards" ], "Title": "Monte Carlo Simulation of 7 Card Stud Poker" }
270084
<p>I have this assignment with the goal of improving the performance and execution time of a FFT C++ code without the use of external libraries. The code is as following:</p> <pre><code>void FftCalculator::ButterflyFFT(std::complex&lt;double&gt; *a, std::complex&lt;double&gt; *b, ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T04:00:10.350", "Id": "533166", "Score": "3", "body": "[Don't cross post](https://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu) your [question](https://stacko...
[ { "body": "<ol>\n<li><p>Use <code>float</code> instead of <code>double</code>.</p>\n</li>\n<li><p>Don't use <code>logdegree_ = log2(degree_)</code>, you can use <code>std::bit_width</code> (<a href=\"https://en.cppreference.com/w/cpp/numeric/bit_width\" rel=\"nofollow noreferrer\">https://en.cppreference.com/w/...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T02:50:52.693", "Id": "270085", "Score": "-1", "Tags": [ "c++", "performance" ], "Title": "HOW can I optimize this FFT C++ Code without using external libraries?" }
270085
<p>I'm trying to build a directory website with ReactJS as a frontend and Python Flask as a backend. I'm trying to pass the text inputs in my searchbar.js to my Python script but I cant find a way to display the data that I've passed from the frontend in my backend to make sure I've really passed the data.</p> <p>Here'...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T09:26:15.367", "Id": "533176", "Score": "2", "body": "Welcome to Code Review! Can you confirm that the code is complete and that it functions correctly? If so, I recommend that you [edit] to add a summary of the testing (ideally as ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T07:12:59.087", "Id": "270090", "Score": "-2", "Tags": [ "python", "javascript", "react.js", "form", "flask" ], "Title": "How to pass input data from ReactJS (Frontend) to ...
270090
<p>I use the below code to sort <code>List&lt;DataAccessViewModel&gt;</code> list.</p> <p>Here is the sort order :</p> <ol> <li><code>PriorityScore</code></li> <li><code>MName</code></li> <li><code>CName</code></li> <li><code>FName</code></li> </ol> <p>It works as expected.</p> <pre><code>public int Compare(DataAccessV...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T06:10:46.260", "Id": "533242", "Score": "1", "body": "please provide `DataAccessViewModel` class." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T08:12:54.457", "Id": "533249", "Score": "2", ...
[ { "body": "<p>First of all, your code has an error. Once you do this.PriorityScore?.CompareTo(mod.PriorityScore), for a PriorityScore that I assume it's a Nullable int, for any null value you will get null, then casting to int will fail. Or if mod.PriorityScore is null, the CompareTo method will fail.</p>\n<p>F...
{ "AcceptedAnswerId": null, "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T16:36:06.837", "Id": "270097", "Score": "1", "Tags": [ "c#", "sorting" ], "Title": "Sorting based on multiple fields using IComparer" }
270097
<p>I know my code is ugly and unreadable. I originally had the game working without class functions but when I had to implement class function it all went downhill.</p> <p>TennisMaster.py</p> <pre><code>import random import time import pygame import Menu from RunningGame import * class TennisMaster(RunningGame): d...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T20:01:30.330", "Id": "533225", "Score": "0", "body": "I tried to run your code, but the resource files are missing. Do you have a git repo online that we can download from?" }, { "ContentLicense": "CC BY-SA 4.0", "Creati...
[ { "body": "<p>I took a preliminary look at your code. Here are some basic tips:</p>\n<h2>1. Include a link to a repo hosting site.</h2>\n<p>You've got multiple files. You've got image resources. You've got code that computes the names of the images it wants to load!</p>\n<p>This is all smooth and sophisticated,...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T19:37:29.020", "Id": "270099", "Score": "1", "Tags": [ "python-3.x", "game", "classes", "pygame" ], "Title": "When I try to re set up my code after failing in the game I cant ...
270099
<p>This logic checks different method and adds links to response that is returned to a view. I there a better way to do this ?</p> <pre><code> [HttpGet] [StandaloneResponseFilter] public JsonResult GetMenuLinkList() { List&lt;FlyoutMenuLinkItem&gt; response = new List&lt;FlyoutMenuLinkItem&gt;();...
[]
[ { "body": "<p>it seems <code>DisplayLink()</code> , <code>DisplayGroupLink()</code> have a bad naming, which made you store them in a variable with a better naming. if you're working on old code that has not followed good practices, I would suggest you avoid using it directly, and instead, implement a new class...
{ "AcceptedAnswerId": "270109", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T21:08:03.083", "Id": "270101", "Score": "1", "Tags": [ "c#", "asp.net-mvc" ], "Title": "JsonResult Building menu" }
270101
<p>I have created a template class <code>Gallery</code> which is intended to be used as a container for objects. I used a private member of type<code>std::map</code> to maintain the collection alongside other functions. This class was not intended to be used on production code but rather to help me practice design and ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T23:29:08.397", "Id": "533231", "Score": "3", "body": "Welcome to Code Review! I [changed the title](https://codereview.stackexchange.com/posts/270103/revisions#rev-body-ad82d9b8-eb49-443e-b18d-4eb9e9538999) so that it describes what...
[ { "body": "<p>First impression: looking good.</p>\n<pre><code>#ifndef GALLERY_H\n#define GALLERY_H\n</code></pre>\n<p>The name is hardly unique. In real code, you need to consider that programs will include headers (possibly indirectly, several levels deep) from different unrelated libraries. Any simple name...
{ "AcceptedAnswerId": "270104", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-15T22:52:12.670", "Id": "270103", "Score": "2", "Tags": [ "c++", "beginner", "template", "classes", "polymorphism" ], "Title": "Gallery template class" }
270103
<p>I finally got this working but I am concerned I am being 'too' specific in my tests, and also that I am repeating myself a significant amount.</p> <p>I could also combine all of the failures into a single test but that feels incorrect as I could change max to 500 and then the entire thing would fail.</p> <p>Namely, ...
[]
[ { "body": "<p>Approaching duplication in test one should usually be very careful not to introduce unnecessary dependencies between the <strong>test</strong> and <strong>fixtures</strong>.</p>\n<p>Oftentimes we encounter <strong>accidental duplication</strong> between tests that gets too eagerly removed - like c...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T01:50:17.417", "Id": "270106", "Score": "1", "Tags": [ "unit-testing", "ruby-on-rails" ], "Title": "Optimize Tests in Rails6 - Minitest - Factory" }
270106
<p>I just implemented the Kosaraju's algorithm in Go. I tried to implement the same algorithm that is described in <a href="https://en.wikipedia.org/wiki/Kosaraju%27s_algorithm" rel="nofollow noreferrer">the relevant Wikipedia page</a>:</p> <pre class="lang-none prettyprint-override"><code>For each vertex u of the grap...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T07:08:13.323", "Id": "270108", "Score": "0", "Tags": [ "performance", "graph", "go" ], "Title": "Kosaraju's algorithm is too slow" }
270108
<p>I have some code that uses a <code>lambda</code> to enhance the functionality. For backward compatibility reasons, this lambda can take one or two arguments. To handle these cases, I now use <code>except TypeError</code> to differentiate in the calls:</p> <pre><code># This should work for both these cases: # l = lam...
[]
[ { "body": "<p>I would move the lambda into a full function. There are some schools of though that lambdas should never be assigned and persisted to variables (the alterative being they're directly passed as arguments.</p>\n<p>What your existing code shows is that you'd like the second argument (<code>y</code>) ...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T10:52:57.187", "Id": "270111", "Score": "0", "Tags": [ "python", "lambda" ], "Title": "Is using except TypeError the right way to do this?" }
270111
<p>I'm experimenting with some variations of validation pattern. I've created Validator class:</p> <pre><code>public class Validator&lt;O&gt; { private O toValidate; private ValidationResult error; private Validator(O object) { this(object, null); } private Validator(O object, ValidationR...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T06:35:33.807", "Id": "533300", "Score": "1", "body": "Are you aware of \"Bean Validation API\"? And if yes, why do you consider it not suitable?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T07:38:5...
[ { "body": "<p>Frankly, I have a hard time trying figuring out how the validator is supposed to work. Either the code needs a lot of documentation or it requires comprehensive redesigning.</p>\n<p>I don't understand the purpose of the <code>toFirstError</code> methods. The names suggest that they perform a valid...
{ "AcceptedAnswerId": "270148", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T14:18:44.040", "Id": "270117", "Score": "1", "Tags": [ "java", "validation" ], "Title": "my idea of validating data and bussiness logic" }
270117
<p>A hiring company gave me the following challenge:</p> <blockquote> <p>We want a function which accepts a very large list of prices (<code>pricesLst</code>) and returns the largest possible loss a client could have made with only a buy transaction followed by a sell transaction. The largest loss is calculated as <cod...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T14:40:39.613", "Id": "533265", "Score": "0", "body": "I think you misunderstood the problem. You don't get a list of buy/sell pairs, you get a list of daily (?) prices like [100, 237, 42, 93, 17, 140, 121] and you must return that b...
[ { "body": "<p>You may have misinterpreted the question. Still, you've written code based on your interpretation of the problem, and we can still make review comments on that code to help you write better code in the future ...</p>\n<h1>PEP 8</h1>\n<p><a href=\"https://pep8.org/\" rel=\"nofollow noreferrer\">PEP...
{ "AcceptedAnswerId": "270133", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T14:22:12.347", "Id": "270118", "Score": "4", "Tags": [ "python", "python-3.x", "interview-questions" ], "Title": "Return the biggest loss a client made from prices list" }
270118
<p>I have this JS ajax GET that returns menus to be used in a view. I wanted to see if there is any more way to write this method. Its a lot of code and just wanted to make sure there is no better way to do this?</p> <pre><code> console.log('Processing Login ajax GetMenuLinkList') var url = &quot;/login/GetMenuLinkLis...
[]
[ { "body": "<p>First, make your code work. <code>orderShowMore = true</code> is assigning <code>true</code> to <code>orderShowMore</code> - the code in the block after this is inevitably going to get executed. Just go <code>if(orderShowMore)</code>.</p>\n<p>Second, don't use two variables named <code>data</code...
{ "AcceptedAnswerId": "270142", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T15:47:48.230", "Id": "270120", "Score": "2", "Tags": [ "javascript", "jquery" ], "Title": "JS Menu Post Get method" }
270120
<p>(From <code>stackoverflow.com</code>, they suggest me to post this question here)<br /> I'm trying to build a bot to check with accounts the status of a service connected to each of them, I thought since they have to do some <code>I/O</code> I'd try to use <code>Tokio</code> (also &quot;<em>to make my bones</em>&quo...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T16:22:30.237", "Id": "270125", "Score": "0", "Tags": [ "rust", "asynchronous", "async-await" ], "Title": "Rust infinite loop in Tokio tasks join_all() made concurrency?" }
270125
<p>Please be brutal with my attempt at logging middle ware.</p> <p>The aim of the middle ware is to tag all the logging with the same tracing detail as the apm modules from elastic that are sent to apm-server <a href="https://github.com/igknot/apmzap" rel="nofollow noreferrer">https://github.com/igknot/apmzap</a></p> <...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-18T17:08:15.997", "Id": "533434", "Score": "0", "body": "Is it a rational thing to do? When you've got apm span's you'll have all the above data over there, in that case you'll duplicate it. The fields that you should add to your logs ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T16:38:18.830", "Id": "270126", "Score": "0", "Tags": [ "go", "logging", "elasticsearch" ], "Title": "Go middleware for logging with ZAP and elastic APM" }
270126
<p>I have to improve this code that searches for missing and duplicates values in a list:</p> <pre><code>using System; using System.Collections.Generic; namespace Test { class Program { static void Main(string[] args) { Console.WriteLine(&quot;Hello World!&quot;); int[]...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T20:02:25.440", "Id": "533289", "Score": "1", "body": "https://ericlippert.com/2012/12/17/performance-rant/" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T20:15:48.767", "Id": "533290", "Score...
[ { "body": "<p>From an <span class=\"math-container\">\\$O(n)\\$</span> perspective, the code is already pretty fast. Everything in the loops is constant or amortized constant.</p>\n<p>So let's look at memory. Allocating the dictionary is something we can remove, the lists belong to the return and cannot be remo...
{ "AcceptedAnswerId": "270151", "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T19:52:00.200", "Id": "270127", "Score": "0", "Tags": [ "c#" ], "Title": "Use less memory and make it runs faster (if it is possible)" }
270127
<p>I tried to recreate Reddit's functionality of replacing <code>r/*</code> on a comment with a link to the subreddit and I came up with this:</p> <pre><code>import React, { useRef, useState } from 'react'; const LinkReplace = () =&gt; { const text = useRef(''); const [comment, setComment] = useState([]); const...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T21:57:17.067", "Id": "270130", "Score": "0", "Tags": [ "react.js", "jsx" ], "Title": "Implementing Reddit-like comment links" }
270130
<p>I at one time used class forname newinstance but newinstance is deprecated. I wanted to be able to pass a class name as a string and be able to load a class, so I came up with:</p> <pre><code> public static Object getClass(String myclass) throws ClassNotFoundException, NoSuchMethodException, Insta...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T06:07:06.657", "Id": "533299", "Score": "2", "body": "Can you elaborate on why would you want to pass the class name as a string? The instantiating mechanism comes with a host of security issues and your example use case makes no se...
[ { "body": "<p>The concept is odd to me and I've made a comment about clarifications. In the mean time... a few pointers about code style.</p>\n<p>The method name <code>getClass</code> suggests that you are getting a class, when in fact you are returning an instance. To better convey the purpose of the method, y...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-16T22:43:30.380", "Id": "270131", "Score": "0", "Tags": [ "java" ], "Title": "Java class loader for new instance" }
270131
<p>I am working with OpenSSL and writing an AES256 encryption module. My knowledge of cybersecurity is not vast and I would like to know whether there are any obvious holes I'm leaving. The intent is for the user to construct an instance of <code>AESEncDec</code> passing a key. With that instance, they may encrypt and ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T10:40:34.393", "Id": "533319", "Score": "2", "body": "Don't use `EVP_BytesToKey`. It's considered legacy and out of date. Use PBKDF2 instead. You don't say what version of OpenSSL you are using. In 3.0 you can use the EVP_KDF APIs f...
[ { "body": "<h1>Makefile review</h1>\n<p>Make more use of built-in rules.</p>\n<p>We should be assigning <code>CXX</code> and <code>CXXFLAGS</code> (instead of <code>CFLAGS</code>), then we can use the built-in rule to compile C++ code from source.</p>\n<p><code>-o</code> on its own isn't a valid flag, and will ...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T07:24:44.890", "Id": "270139", "Score": "4", "Tags": [ "c++", "cryptography", "aes", "openssl" ], "Title": "C++ AES Encryption Class" }
270139
<p>There are 1.3M documents in my collection (5.0 and hosted directly on mongodb.com) and there is an index on &quot;topic&quot; and a combined index on &quot;topic&quot; and another field. However the pymongo query of</p> <pre><code>mng.distinct('topic', {&quot;topic&quot;: {&quot;$regex&quot;: &quot;XXX-XXX/XX/X/XXX/...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T09:38:30.727", "Id": "270145", "Score": "0", "Tags": [ "python", "performance", "regex", "database", "mongodb" ], "Title": "Why is this MongoDB query so slow in comparison...
270145
<p>In my class the constructor queries data from the database. In the database there is a table containing more than <strong>400k records</strong>. After the query I tested memory size- it uses more than <strong>10m++ bytes</strong>. so this query makes it very very slow.</p> <p>This my class contructor</p> <pre><code>...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T12:24:19.207", "Id": "533330", "Score": "2", "body": "This question is of very poor quality. I'm not sure it is ready for review. Can you flesh it out a bit more? Which framework are you using? What is your code used for? What shoul...
[]
{ "AcceptedAnswerId": null, "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T10:01:31.030", "Id": "270147", "Score": "0", "Tags": [ "php", "laravel" ], "Title": "query data from mapping name but use many memory" }
270147
<p>I consume a RestApi with few Combine Publishers and want to visually represent ongoing progress with UIActivityIndicatorView. My current logic uses <code>handleEvents-&gt;receiveSubscription</code> closure to start an animation and <code>handleEvents-&gt;receiveCancel</code> and <code>sink-&gt;completion</code> to s...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T10:51:55.747", "Id": "270152", "Score": "0", "Tags": [ "swift" ], "Title": "Start / stop animating activityIndicatorView for many dataTaskPublishers" }
270152
<p>I have this code that writes the initial configuration of a simulator I'm writing to <code>stdout</code>. <code>args</code> is an instance of type <code>struct Arguments</code>, and all the members of said struct are used in the singular function below. I was hoping for some hints to simplify the code and get the al...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T12:21:11.080", "Id": "533327", "Score": "0", "body": "You're missing the definition of `args`. Without that, it's very hard to review this code." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T13:14:...
[ { "body": "<ul>\n<li><p>Don't use <code>std::endl</code> unless you actually need flushing behavior. For a newline, just output <code>&quot;\\n&quot;</code>.</p>\n</li>\n<li><p>Use the manipulators from <a href=\"https://en.cppreference.com/w/cpp/io/manip\" rel=\"nofollow noreferrer\"><code>&lt;iomanip&gt;</cod...
{ "AcceptedAnswerId": "270161", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T11:41:04.417", "Id": "270155", "Score": "0", "Tags": [ "c++", "formatting" ], "Title": "Is there a neater, more elegant way to format this output?" }
270155
<p>The following code log INFO in terminal and WARNING, ERROR or CRITICAL in file.</p> <p>my python file looks like:</p> <pre><code>import logging import os import logging.config import yaml DEFAULT_LEVEL = logging.DEBUG class infoFilter(logging.Filter): def filter(self, log_record): return log_record.lev...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T12:21:17.110", "Id": "270156", "Score": "0", "Tags": [ "python", "python-3.x" ], "Title": "view only INFO in console and save CRITICAL, ERROR, WARNING to log file" }
270156
<p>Relatively new to the Design patterns, Generally my works are writing function for the needs. But now i need to implement a undo redo functionality, so i just read about the different patterns which i can use for that and found that, memento pattern is the one we can go for. So try to write the code to implement tha...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T13:05:55.593", "Id": "270159", "Score": "2", "Tags": [ "javascript", "design-patterns", "node.js" ], "Title": "Undo/Redo implementation using Memento pattern Javascript" }
270159
<p>I have an application using Django Rest Framework and a <code>ListModelView</code> for a model which I basically need to filter for in a MongoDB. The call for MongoDB is made in a model method of the model and referenced as a SerializerMethodField in the serializer. So when requesting the list endpoint there are n c...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T13:40:04.757", "Id": "270160", "Score": "0", "Tags": [ "python", "django", "rest", "mongodb" ], "Title": "Possible to merge model method database calls?" }
270160
<p>The program is a <a href="https://en.wikipedia.org/wiki/Caesar_cipher" rel="nofollow noreferrer">Caesar's cipher</a> decoder. It compiles and works ok, but in Valgrind, I receive a lot of errors and I have no idea how to solve them.</p> <p>I have tried with --track-origins=yes, but I still have no clue what's wrong....
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T16:41:20.043", "Id": "533344", "Score": "1", "body": "`size_t len = strlen(message) - 1; // -1 Because of '\\0'` That doesn't make sense, since `strlen` does not count the terminator." }, { "ContentLicense": "CC BY-SA 4.0",...
[ { "body": "<pre><code> /* Same as mandatory, only length comparison check is removed */\n</code></pre>\n<p>Don't do that. You duplicated the entire (complex) function to make minor changes; specifically to skip error checks.</p>\n<p>Write one copy of the function. Put the optional checks in another prelimi...
{ "AcceptedAnswerId": null, "CommentCount": "10", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T15:15:47.990", "Id": "270163", "Score": "-1", "Tags": [ "c", "caesar-cipher" ], "Title": "Caesar's cipher decoder works but Valgrind shows many errors" }
270163
<p>I wanted to see how simple it would be to implement a stack-based interpreter in C# based on this question: <a href="https://codereview.stackexchange.com/questions/270065/simple-stack-based-interpreter">Simple stack based interpreter</a></p> <p>The program works with the command line arguments which can either be a ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-18T09:58:40.990", "Id": "533407", "Score": "1", "body": "I would suggest to use [ValueTuple with named fields](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/value-tuples#tuple-field-names) to increase ...
[ { "body": "<h3><code>PopStack</code></h3>\n<ul>\n<li>This can be rewritten like this using LINQ:</li>\n</ul>\n<pre><code>private static object[] PopStack(Stack&lt;double&gt; stack, int count)\n =&gt; Enumerable.Range(0, count).Select(_ =&gt; stack.Pop()).Cast&lt;object&gt;().ToArray();\n</code></pre>\n<h3><c...
{ "AcceptedAnswerId": "270199", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T16:03:04.923", "Id": "270164", "Score": "2", "Tags": [ "c#" ], "Title": "Simple stack based interpreter, C# style" }
270164
<p>I'm just learning how to allow interconnected apps via Sockets, watched a tutorial last night and based on that this is what I've gotten:</p> <pre><code>Server.cs </code></pre> <p>Code:</p> <pre><code>using System; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; namespace Socket...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T17:37:47.633", "Id": "533361", "Score": "1", "body": "After reading the title, I thought you were trying to implement some sort of artificial intelligence machine learning socket ;-)" }, { "ContentLicense": "CC BY-SA 4.0", ...
[ { "body": "<h1>Disposing of Disposables</h1>\n<p>The main problem in your code is that you are not disposing of <code>clientWriter</code>. A good rule to remember is that you should <b>always</b> dispose of disposable objects. If you do not dispose of <code>clientWriter</code> then it will never be flushed or c...
{ "AcceptedAnswerId": "270171", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T16:11:31.873", "Id": "270165", "Score": "3", "Tags": [ "c#", ".net", "socket", "tcp" ], "Title": "Learning Sockets in C# (.Net Framework), Suggested Improvements?" }
270165
<h3>The Goal</h3> <h5>Current PHP version 7.3.5</h5> <p>The block will have a function that sources a defined set of illustrations that are stored in <code>{themeName}/images/illustrations</code>. Those file names are then used to populate a list in the block editor (<code>index.js</code>) as well as be assigned to an ...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T17:37:55.653", "Id": "270169", "Score": "0", "Tags": [ "javascript", "php", "wordpress" ], "Title": "Wordpress Custom Block that sources files from the theme images directory" }
270169
<p>[edit acc. a comment:]</p> <p>Goal: clean <strong>correct</strong> powers of ten acc. IEEE 754 definition <strong>'nearest'.</strong> Useable also in a 'C' environment.</p> <p>As far as I could test evaluation of '1Ei' strings <strong>is</strong> nearest with most compilers / options,</p> <p>To what end: I'm testing...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-18T08:59:48.513", "Id": "533399", "Score": "1", "body": "At Code Review we only review complete and working code. This question is better suited for [StackOverflow](https://stackoverflow.com/questions)." }, { "ContentLicense": ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-11-17T18:25:49.617", "Id": "270170", "Score": "-1", "Tags": [ "c", "mathematics", "compiler" ], "Title": "get clean powers of ten, with C or as 'with C shareable library', for integer e...
270170