body
stringlengths
25
86.7k
comments
list
answers
list
meta_data
dict
question_id
stringlengths
1
6
<p>I am trying to retrieve filename and ID list with Google Drive API (the latest <a href="https://developers.google.com/drive/api/v3/about-sdk" rel="nofollow noreferrer">Drive API version v3</a> is used here) as a first step in order to analyze and manipulate these files on Google Drive. The experimental implementatio...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T07:35:32.790", "Id": "511734", "Score": "2", "body": "Which version of C# are you using? I'm asking it because for instance since C# 7.1 `async main` is [supported](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/p...
[ { "body": "<p>First of all let me clarify that I'm not familiar with the Google Drive API. I've done some refactoring but I haven't tested it (just make it compile).</p>\n<p>If I can assume you are using greater C# version than 8 then you can refactor your code like this:</p>\n<pre class=\"lang-cs prettyprint-o...
{ "AcceptedAnswerId": "259556", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-12T23:35:50.017", "Id": "259439", "Score": "0", "Tags": [ "c#", "file-system", "api", "web-services", "google-drive" ], "Title": "Retrieve filename and ID with Google Dri...
259439
<p>I want this function to find the closest value to <code>n</code> such that <code>32 % n == 0</code> in Java. I'm trying to make this more efficient / functional. Here is what I have tried, but I'm sure there is a better way. I'm using Java 8.</p> <p>Question: Is there a better way to implement this function that is ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T22:05:46.933", "Id": "511831", "Score": "0", "body": "please clarify what constraints on `n` do we have (like, could it be negative? 0?).\n\nAlso if `n > 32` then answer should be 32 it seems." } ]
[ { "body": "<p>Just some idea.</p>\n<p>32 = 2<sup>5</sup>, so <em>n</em> = 2k where integer <em>k</em> &lt;= 5. k = -2 for 0.26.</p>\n<p>That allows integer arithmetic to some degree, diminishing floating point errors.</p>\n", "comments": [], "meta_data": { "CommentCount": "0", "ContentLicens...
{ "AcceptedAnswerId": "259493", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T00:26:57.940", "Id": "259440", "Score": "1", "Tags": [ "java" ], "Title": "Modulo Algorithm" }
259440
<p>I'm a C/C++ programmer and this is my first Rust program. A heavy simplification of the console system like used in Quake and Source engine games, that lets you set variables and run commands.</p> <p>I'm aware the parsing algorithm is bad, it's just supposed to be simple. I want to know how I can improve this code t...
[]
[ { "body": "<ol>\n<li>Use <code>std::collections::HashMap</code></li>\n</ol>\n<p>Your variables and functions are stored in a <code>Vec&lt;ConVar&gt;</code> or <code>Vec&lt;ConCommand&gt;</code>, instead use a <code>HashMap&lt;String, String&gt;</code> and <code>HashMap&lt;String, fn(&amp;[String]&gt;</code>. Th...
{ "AcceptedAnswerId": "259548", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T01:52:52.620", "Id": "259441", "Score": "2", "Tags": [ "console", "rust" ], "Title": "A simple console in Rust that stores variables runs commands" }
259441
<p>I recently completed a coding challenge for a company that did not get me to the next stage. They were kind enough to provide the following feedback:</p> <blockquote> <p>The coding assignment does not match what we are looking for, a mid-level Front End Engineer. The code does not fully comply with what is asked in ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T05:58:31.637", "Id": "511719", "Score": "0", "body": "How long did you have to complete the assignment? Where you able to ask for clarification on any of the specifications?" }, { "ContentLicense": "CC BY-SA 4.0", "Crea...
[ { "body": "<blockquote>\n<p>The code does not fully comply with what is asked in the assignment and the code readability is sometimes hard.</p>\n</blockquote>\n<p>These critiques will be corrected throughout the code when we implement the fundamental idea to ...</p>\n<p><strong>Manipulate the data, not the disp...
{ "AcceptedAnswerId": null, "CommentCount": "13", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T03:56:06.597", "Id": "259442", "Score": "4", "Tags": [ "javascript", "interview-questions", "ecmascript-6" ], "Title": "Randomly rearrange table rows without unnecessary reflows"...
259442
<h1>All your votes are belonging to me.</h1> <p>I would make a good moderator because I care about the underdogs. After work, I have free time to contribute so I want to use the time to help others.</p>
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T09:45:05.803", "Id": "511744", "Score": "0", "body": "Hey samayo, customarily the answers go in the answer thread found [here](https://codereview.meta.stackexchange.com/q/10663). The text found here is normally a little blurb about ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T08:37:14.010", "Id": "259443", "Score": "0", "Tags": null, "Title": null }
259443
<p>Imagine you can't use the standard functions for time calculation or anything alike. You have to start from scratch as it is the case on embedded systems.</p> <p>Thus I came with the following code to determine the seconds, minutes, hours, days, months and years from unix timestamp. Tested the code, works for everyt...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T20:04:30.130", "Id": "511818", "Score": "1", "body": "You take into account leap years. But not the century not being leap years (unless it is also divisible by 4)." } ]
[ { "body": "<p><code>std::atoi()</code> is a poor choice of conversion function, as its means of reporting errors is indistinguishable from a valid conversion. The necessary header hasn't been included anyway.</p>\n<p><code>uint8_t</code> is not declared - did you mean <code>std::uint8_t</code> from <code>&lt;c...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T08:43:31.760", "Id": "259446", "Score": "0", "Tags": [ "c++" ], "Title": "Unix timestamp to days, months, years" }
259446
<p>After searching a lot, on how to do it and not finding any good solutions, I implemented my own UDP livestream from an Android device to a C#/WPF desktop application. It works, however, since I get complete JPEG images from the camera2 API each frame in android, I need to wait until I have data for the complete imag...
[]
[ { "body": "<p>I have no experience with Kotlin, so I'll purely be focusing on the C# part</p>\n<hr />\n<p><strong>Empty <code>#region</code>s</strong>:<br />\nDelete them, they just take up unnecessary space. In the same vein, I personally add an empty line after the <code>#region</code> and just before <code>e...
{ "AcceptedAnswerId": "259456", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T09:34:58.883", "Id": "259447", "Score": "1", "Tags": [ "c#", "android", "kotlin", "udp" ], "Title": "UDP image livestream from Android device to C# desktop application" }
259447
<p>I've made this to pick the LQR parameters for my self balancing robots simulation. So to break down what I have done,</p> <p><strong>Randomly Create Population</strong></p> <ol> <li><p>I create a random population. The population is a list of lists having 4 parameters each of which is randomly generated. But I have ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T10:03:45.140", "Id": "511747", "Score": "1", "body": "Hey there, I'm under the impression this community is for reviewing code that is working, and not necessarily to check the correctness of your code :)" }, { "ContentLicen...
[ { "body": "<p><strong>On the style of the code</strong>:</p>\n<p>While I'm not saying the code is or isn't correct, there's some small tweaks you could make it to improve it's legibility:</p>\n<p><strong>Spacing</strong></p>\n<p>Write code like you would write English (in some sense :P). After commas you needs ...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T10:01:15.703", "Id": "259451", "Score": "4", "Tags": [ "python", "algorithm", "simulation", "genetic-algorithm" ], "Title": "Python Genetic Algorithm Implementation" }
259451
<p>I'm looking for ideas on how to optimize the following code. I don't really know how to condense anything, I'm still very new to coding and this is the first time I've really created anything besides &quot;Hello World&quot;.</p> <pre><code>import pandas as pd import csv #Method that calculates the Current Budget of...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T10:44:29.940", "Id": "511751", "Score": "0", "body": "I really liked that you grouped related `print`s in functions to call repeatedly! One thing you might consider is factoring the different actions you take, depending on the `user...
[ { "body": "<p>Good first effort!</p>\n<p><strong>On <code>currentBudget</code></strong>:</p>\n<p>One of the things that is easy to tell you about is Python's context managers <a href=\"https://docs.python.org/3/reference/compound_stmts.html#the-with-statement\" rel=\"nofollow noreferrer\">docs</a>.</p>\n<p>The ...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T10:05:10.990", "Id": "259452", "Score": "5", "Tags": [ "python", "pandas" ], "Title": "Reading and analyzing budget and transaction data from user input and .csv" }
259452
<p>I have two access roles as of now for example <code>account_type</code> <code>1</code> and <code>2</code>.</p> <p>What I am doing is, <code>account_type 1</code> can log in using mobile no and <code>account_type 2</code> can log in with email and password.</p> <p>Both scenarios are working with the below code but is...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T12:15:11.637", "Id": "511760", "Score": "0", "body": "Please fix your indentation." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T12:18:37.700", "Id": "511761", "Score": "0", "body": "@BC...
[ { "body": "<p>Few obvious issues in logic:</p>\n<ol>\n<li><p>You are just getting mobile number, but not validating it with an OTP or any password associated with it! This makes anyone can login with any mobile number.</p>\n</li>\n<li><p>Too many error messages like, enter mobile number, enter 10 digits, enter ...
{ "AcceptedAnswerId": "259491", "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T11:59:47.053", "Id": "259457", "Score": "1", "Tags": [ "php", "validation", "pdo" ], "Title": "What is the best way to login according to account type with server-side validat...
259457
<h1>Kartik Chhajed</h1> <p>Last year, I was new in this community. I learned a lot of things that helped me write efficient code for my research in theoretical physics. I want to be the moderator for a simple reason - I would like to reciprocate to the community in the best way possible, and I am good at managing thing...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T15:05:00.430", "Id": "511774", "Score": "1", "body": "To be honest, you don't have enough experience on the Code Review site. You haven't acquired any of the moderation badges yet and you don't participate in the 2nd Monitor Chat si...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T11:59:54.433", "Id": "259458", "Score": "0", "Tags": null, "Title": null }
259458
<h1>Mast</h1> <p>Welcome to round 2. I ran for moderator <a href="//codereview.stackexchange.com/election/2#post-190589">during the election of '18</a> and am still more than willing to take on more responsibilities.</p> <p>I'll quote most of my previous nomination because it's still accurate:</p> <blockquote> <p>While...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T23:20:50.883", "Id": "511839", "Score": "6", "body": "As a moderator one of your roles will be handling disputes between users. When you are engaged in/trying to resolve disputes I have noticed that you occasionally loose your tempe...
[]
{ "AcceptedAnswerId": null, "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T16:20:41.963", "Id": "259465", "Score": "0", "Tags": null, "Title": null }
259465
<p>So the problem is</p> <blockquote> <p>Find the duplicate entries (2nd occurrence onwards) in the given numpy array and mark them as True. First time occurrences should be False.</p> </blockquote> <p>And my solution is:</p> <pre><code>import numpy as np def duplicates(a): uniques = np.unique(a) result = [] ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T17:06:27.593", "Id": "511787", "Score": "1", "body": "Hey, thanks for your question. I answered it but I edited it a bunch of times, so be sure to check the final version of the answer now. Let me know in the comments if you have qu...
[ { "body": "<p>Your code is good code, I'd say. There's nothing wrong with it. The only thing is that you can write more or less the same algorithm in a much shorter way, and that essentially means you would refactor all of your code down to a single line.</p>\n<p>So, before taking a look at the boiled down vers...
{ "AcceptedAnswerId": "259469", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T16:40:45.723", "Id": "259467", "Score": "6", "Tags": [ "python", "array", "numpy" ], "Title": "Marking duplicate entries in a numpy array as True" }
259467
<p>I have made a <a href="https://github.com/rafisics/suvat_calculator" rel="nofollow noreferrer">calculator app</a> to help Bengali high-school students in solving mathematical problems on Newtonian equations of linear motion aka SUVAT equations. I am using python version 3.8.8 and <a href="https://docs.streamlit.io/e...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:24:59.903", "Id": "511885", "Score": "0", "body": "Hey, can you please explain a bit better what you mean by the LaTeX remark at the end? You seem to have some LaTeX in other places, so what is the \"problem\" with adding more?" ...
[ { "body": "<p><strong>Bundle input calls</strong>:</p>\n<p>Like you said, some code is repeated. That's fine, you are here to learn :)</p>\n<p>The first thing I noticed was a bunch of <code>ask</code> calls in the beginning of many cases of your <code>elif</code>.\nWhat I thought was &quot;why not bundle those ...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T16:42:23.733", "Id": "259468", "Score": "3", "Tags": [ "python", "python-3.x", "calculator" ], "Title": "SUVAT Calculator web app using python streamlit" }
259468
<p>I am making a video editor with tkinter, and seriously need to clean it up and make it nicer to read / more efficient. Can anybody help me clean up my code (I was sent here from stackoverflow)</p> <p>Here it is: <a href="https://github.com/MiniMinnoww/moviepy-video-editor" rel="nofollow noreferrer">https://github.co...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T17:35:54.443", "Id": "511790", "Score": "3", "body": "Welcome to Code Review! \" Questions must [include the code to be reviewed](https://codereview.meta.stackexchange.com/a/3653/120114). Links to code hosted on third-party sites ar...
[ { "body": "<p><strong>Deferring command execution with a simple lambda</strong></p>\n<p>It is very similar to what you did, but no need to bring in heavier artillery like <code>functools.partial</code>, especially because you have no idea who is going to read your code and they may not understand it :(</p>\n<p>...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T17:20:31.917", "Id": "259471", "Score": "0", "Tags": [ "python" ], "Title": "Video Editor Clean up" }
259471
<p>I have 3 push buttons, 3 leds, and 2 relays. When you push button1 once, the led1 turns on and timer is set to 10 sec. When push button1 twice, led2 turns on and timer is set to 20 sec. When push second button once, select first relay. When pushs second button twice, then select second relay. And in the end start bu...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T20:02:34.087", "Id": "511816", "Score": "1", "body": "Please post 'GyverButton.h' as well, assuming you wrote that include." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T20:06:40.167", "Id": "51...
[ { "body": "<p>Unfortunately, it looks like your code won't work.</p>\n<p>The last condition:</p>\n<pre><code>if(butt3 = HIGH){\n</code></pre>\n<p>will always be true.</p>\n<p>This is a common mistake in C and C++, missing one = in a condition, turning it in to an assignment.</p>\n<p>A useful trick to avoid this...
{ "AcceptedAnswerId": "259483", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T19:48:04.570", "Id": "259478", "Score": "1", "Tags": [ "algorithm", "c", "arduino" ], "Title": "Arduino algorithm" }
259478
<p>This is a simple interpreter for the esoteric <a href="https://en.wikipedia.org/wiki/Brainfuck" rel="nofollow noreferrer">brainfuck programming language</a>, written in C. It is one of my personal projects and I would love to receive expert advice.</p> <h2>Behavior</h2> <ul> <li><p>All characters except the eight co...
[]
[ { "body": "<p>The code is easy to read and to follow. There isn't a global in sight, the indentation is consistent, you use <code>EXIT_SUCCESS</code> and <code>EXIT_FAILURE</code>, and the control flow is simple. Therefore I have no comments about superficial aspects of style.</p>\n<hr />\n<p>However, there is ...
{ "AcceptedAnswerId": "259517", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T20:50:05.047", "Id": "259480", "Score": "3", "Tags": [ "c", "interpreter", "brainfuck" ], "Title": "Simple Brainfuck Interpreter in C" }
259480
<p>Here is a short pice of code that suppose to work as Pub/Sub or EventDisptacher of some sort.</p> <p>I only do code in JS a few times a year, so hence I'm asking for your time. Right now I'm working on little full-stack pice for my portfolio, and I'm really not a frontend developer :)</p> <p>Here is the code:</p> <p...
[]
[ { "body": "<h2>Style nitpicks</h2>\n<ul>\n<li><p>Be consistent with Allman vs Egyptian braces:</p>\n<pre class=\"lang-js prettyprint-override\"><code>constructor()\n{\n this.name = &quot;name&quot;;\n sd.register(this, &quot;List:1234&quot;, &quot;print&quot;, this.printName);\n}\n</code></pre>\n<p>should be:...
{ "AcceptedAnswerId": "259532", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-13T21:38:15.543", "Id": "259481", "Score": "4", "Tags": [ "javascript", "ecmascript-6", "event-handling" ], "Title": "Javascript Pub/Sub" }
259481
<p>I wrote this code for a fibonacci sequence generator. Can anyone tell me whether my code is designed well? if not, why?</p> <pre><code>import logging def fibonacci_calc(current_val, current_pos=0, max_seq_length=5, sequence_list=[]): try: if(current_pos != 0 and len(sequence_list) == 0): rai...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T12:00:43.920", "Id": "511909", "Score": "1", "body": "What is it supposed to do? At the very very least, show the result of the `fibonacci_calc(19,0, 7)` call you already do." } ]
[ { "body": "<p>tldr; I'd say that this function is too complicated.</p>\n<p>Recursion should be avoided when possible as an iterative method is usually more readable and could be faster. Here's some other things to consider when making a recursive function: <a href=\"https://gist.github.com/abinoda/5593052#when-...
{ "AcceptedAnswerId": "259490", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T00:44:47.680", "Id": "259486", "Score": "0", "Tags": [ "python", "python-3.x", "fibonacci-sequence" ], "Title": "Fibonacci generator python implementation" }
259486
<p>Here's my second try at pairwise summation in Haskell:</p> <pre><code>pairwiseSum :: (Num a) =&gt; [a] -&gt; a pairwiseSum [] = 0 pairwiseSum [x] = x pairwiseSum x = pairwiseSum (sumPairs x) sumPairs :: (Num a) =&gt; [a] -&gt; [a] sumPairs [] = [] sumPairs [x] = [x] sumPairs (x:y:xs) = ((x + y) : sumPairs xs) </cod...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T07:08:57.973", "Id": "511997", "Score": "0", "body": "type `:set +s` at GHCi and you get runtime stats with time and memory usage. But: GHCi is not the right way to test timing, take a look at criterion: https://hackage.haskell.org/...
[ { "body": "<p>Linking the other version of pairwiseSum here <a href=\"https://codereview.stackexchange.com/questions/259289/pairwise-summation-in-haskell\">Pairwise summation in Haskell</a></p>\n<p>That version is an O(nlogn) algorithm, while this one is linear [ie O(n)]. In fact this version is probably the be...
{ "AcceptedAnswerId": "260083", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T01:04:14.890", "Id": "259487", "Score": "0", "Tags": [ "beginner", "haskell" ], "Title": "Pairwise summation in Haskell, take two" }
259487
<p>I'm trying to write a code for a function that takes an empty array of pointers and its length n. And scans n strings of max length of MAX_LEN (a defined constant) until a new line is given by the user. The strings are separated by one space.</p> <pre><code>int scan_strings(char * words[], int n) { char current ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T13:10:36.110", "Id": "511919", "Score": "2", "body": "Welcome to Code Review! Unfortunately this question is _off-topic_ because this site is for reviewing **working** code. Please [take the tour](https://codereview.stackexchange.co...
[ { "body": "<p>The problem is line <code>*(words+j) = &amp;str;</code>. It says that we want <code>words[j]</code> or <code>*(words+j)</code> to point to where the <code>str</code> is pointing. So, at the end of the <code>while</code>, all the <code>words</code> are pointing to the same str with the content of <...
{ "AcceptedAnswerId": "259524", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T06:11:42.340", "Id": "259495", "Score": "-1", "Tags": [ "c", "strings", "array", "pointers" ], "Title": "Scanning multiple strings in one line to a pointers array in C" }
259495
<p>I have been developing a real time application in C and I need to calculate sine and cosine of a given angle in radians. In respect to the fact that the application is a real time application the functions from the standard library are not suitable for my purposes due to the fact that there is not fixed calculation ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T09:52:58.740", "Id": "511892", "Score": "8", "body": "What is the target processor?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T11:24:03.213", "Id": "511902", "Score": "6", "body": "ma...
[ { "body": "<ul>\n<li><code>#define PI 3.14</code>... could use a few more digits!</li>\n<li>sine should work for numbers greater than <code>2.0 * PI</code>.</li>\n<li>sine should work for negative numbers.</li>\n<li>same for cosine.</li>\n<li><code>if(temp &gt; 2*PI) { temp -= 2*PI; }</code> is ineffective for ...
{ "AcceptedAnswerId": null, "CommentCount": "9", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:01:33.460", "Id": "259498", "Score": "8", "Tags": [ "c", "mathematics", "signal-processing" ], "Title": "Implementation of the trigonometric functions for real time application...
259498
<p>I have the following working code:</p> <p><code>person.h</code></p> <pre class="lang-cpp prettyprint-override"><code>#ifndef PERSON_H #define PERSON_H #include &lt;iostream&gt; #include &lt;string&gt; class Person { private: std::string firstName; std::string middleName; std::string lastName; public: ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T17:40:30.040", "Id": "511950", "Score": "1", "body": "Yes. Make `operator<<` call a virtual function on the object. Then you only need to define it for person (not for Tweeter). This will make it print the most derived version." }...
[ { "body": "<p>Yes use a virtual <code>print()</code> function.</p>\n<p>PS. I would also make the <code>toString</code> use the virtual print function to make it more effecient.</p>\n<pre><code>class Person \n{\n // OTHER STUFF\n\n virtual void print(std::ostream&amp; target = std::cout) const\n {\n ...
{ "AcceptedAnswerId": "259527", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:16:28.690", "Id": "259499", "Score": "0", "Tags": [ "c++", "inheritance" ], "Title": "Deduplicate << operator implementation on inheritance" }
259499
<p>Telegram is a cross-platform, cloud-based service used for instant messaging, video calling, file sharing and other social media features.</p> <p>Multiple APIs have been provided (<a href="https://core.telegram.org/bots" rel="nofollow noreferrer">bots</a> and <a href="https://core.telegram.org/tdlib" rel="nofollow n...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:43:38.423", "Id": "259500", "Score": "0", "Tags": null, "Title": null }
259500
Use this tag for questions when developing programs and applications related to the Telegram service. This tag is NOT for support questions about the service itself.
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:43:38.423", "Id": "259501", "Score": "0", "Tags": null, "Title": null }
259501
<p>I have been developing a control software in C++ and for implementation of the control algorithms I need basic matrix operations like addition, subtraction, multiplication and multiplication by scalar.</p> <p>Due to the fact that the application is the real time application I need to avoid the dynamic memory allocat...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-22T15:51:28.703", "Id": "512734", "Score": "0", "body": "Which C++ version are you compiling / going to compile it in?" } ]
[ { "body": "<blockquote>\n<p>I have doubts regarding the decision to have the matrix itself i.e. the array as a public member</p>\n</blockquote>\n<p>I don't like having the array as a public member because it means accessing individual elements looks like a bit strange compared to the other operations.</p>\n<pre...
{ "AcceptedAnswerId": "259539", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T08:59:37.103", "Id": "259503", "Score": "3", "Tags": [ "c++", "matrix", "mathematics", "template-meta-programming" ], "Title": "Implementation of the basic matrix operatio...
259503
<p>I'll start by saying that I just started learning Go coming from Python (and some basic on Java), so I am trying to understand how to write Go code in more idiomatic way and not in a Python way. Any feedback on that would be appreciated!</p> <p><strong>About the exercise:</strong> In this exercise I need to implemen...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T10:43:36.227", "Id": "511895", "Score": "1", "body": "Please follow the guidelines WRT the title of your post: https://codereview.stackexchange.com/help/how-to-ask" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T10:38:56.533", "Id": "259506", "Score": "0", "Tags": [ "object-oriented", "go", "interface" ], "Title": "Filtering methods for 3 collections" }
259506
<p>I'm trying to understand the Functional Programming Paradigm (or style) implemented with Javascript. There are a few things I have difficulties with. The naming conventions, and dependency injections. I would be super happy if you could help me out with these two problems.</p> <pre><code>const items = ['', '', '', '...
[]
[ { "body": "<h2>Naming</h2>\n<p>The name <code>pickRandomItemFrom</code> is too long</p>\n<ul>\n<li><code>pick</code> implies removal which the function does not do</li>\n<li><code>from</code> is redundant.</li>\n</ul>\n<p>Thus <code>pickRandomItemFrom</code> can simply be <code>randomItem</code> with <code>Item...
{ "AcceptedAnswerId": "259521", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T11:19:34.553", "Id": "259509", "Score": "0", "Tags": [ "javascript", "array", "functional-programming" ], "Title": "Functional Programming Style in Javascript Picking a Random...
259509
<p>I'm using <strong>Laravel</strong> and this PHP method is in a <strong>controller</strong>. It's the back-end for a <strong>edit profile</strong> page. The user can change the profile picture, reset the password, the username, and so on. I'm new in PHP and would like to know if there is a better or simpler way to co...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T14:36:03.347", "Id": "511932", "Score": "0", "body": "Welcome to Code Review! 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 ...
[ { "body": "<h3>Redundant (and likely inefficient) code</h3>\n<p>There are multiple blocks that repeat:</p>\n<blockquote>\n<pre><code> if($username){ \n $user-&gt;username = $username; \n $user-&gt;save();\n }\n\n if($wallet_address){\n $user-&gt;wallet_address = $wallet_address;\n...
{ "AcceptedAnswerId": "259535", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T11:27:17.317", "Id": "259510", "Score": "1", "Tags": [ "php", "laravel" ], "Title": "Laravel controller method to update user" }
259510
<p>I have written one method; however I feel I can refactor it even more but not sure what</p> <p>Can someone help me here?</p> <pre><code> public static PaymentOptions GetPaymentOptions_NonGBCulture(TestConfigurationCDO testConfiguration, int siteId) { var paymentOptions = default(PaymentOptions); ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T11:57:39.600", "Id": "511908", "Score": "0", "body": "`.First(x => checkoutGroup.Contains(x.PaymentType));`" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T12:07:01.277", "Id": "511911", "Scor...
[ { "body": "<p>I can see at least two places where you can make your code more concise.</p>\n<h2><code>PaymentType</code></h2>\n<p>As you have suspected replacing multiple <code>x.PaymentType == PaymentMethod.XYZ ||</code> statements with a collection lookup might help. With this approach you separate data from ...
{ "AcceptedAnswerId": "259519", "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T11:50:46.323", "Id": "259512", "Score": "-2", "Tags": [ "c#", "linq", "selenium" ], "Title": "Can I refactor my code anymore?" }
259512
<h1>Anit Shrestha Manandhar</h1> <p>Dear Community Members,</p> <p>I am an experienced software engineer who truly believes that code review is the best way to understand other developer. I have been a using this platform more than others which helps to connect with other unknown person from a different part of the wor...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T14:27:21.433", "Id": "511930", "Score": "8", "body": "You have been a member of the Code Review Community for 3 years but you haven't made any posts to Code Review Meta, how do you explain this? In the same 3 years you haven't reall...
[]
{ "AcceptedAnswerId": null, "CommentCount": "14", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T12:28:30.833", "Id": "259514", "Score": "0", "Tags": null, "Title": null }
259514
<p>I have implemented a producer/consumer functionality using threads in a given framework and I'm pretty sure I did not cover all possible scenarios.<br /> I made a small reproducible version. Lines ending with <code>#</code> simulate the functionality of the framework.<br /> In the original code the total number of p...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T12:40:37.483", "Id": "259516", "Score": "5", "Tags": [ "python", "multithreading", "thread-safety" ], "Title": "stable producer/consumer threads in python" }
259516
<p>I'm quite new to the STL.</p> <p>Does this make sense? Is there a better way of removing the listeners instead of using shared_ptr while keeping the code short and simple? Is there something in the STL to replace this?</p> <p>Class:</p> <pre><code>template&lt;class ... Arguments&gt; class Callback { using Functi...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-27T22:25:42.947", "Id": "513279", "Score": "0", "body": "If you are the only person with a pointer to an object why do you need a \"shared pointer\" just use \"unique pointer\" it would be more efficient. Why dynamically create a point...
[ { "body": "<p>I think this makes sense in terms of STL use. Storing a <code>std::shared_ptr&lt;std::function&gt;</code> is not usually necessary since std::function may own heap allocations internally, but since you return the shared_ptr from addListener it could be passed around. If you never use the returne...
{ "AcceptedAnswerId": "259699", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T17:15:07.230", "Id": "259525", "Score": "4", "Tags": [ "c++", "generics", "template-meta-programming", "callback" ], "Title": "C++ Generic Callback class with removable li...
259525
<p>So here is the problem:</p> <blockquote> <p>Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m respectively and one natural number 'p'. You need to find the distance(Euclidean) of the rows of the matrices 'a' and 'b'. Fill the results in the k×n matrix. Calculate the distance with the following formula <spa...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T17:36:42.787", "Id": "511949", "Score": "2", "body": "Does this code pass all the testcases? It seems to me that you would want `matrix = abs(a - vector)` according to the provided formula. Doesn't matter for an even value `p`, but ...
[ { "body": "<p><code>np.array()</code> takes any kind of nested sequence. So, it isn't necessary to convert to a list before appending to <code>result</code>.</p>\n<pre><code>def dist_mat(a, b, p):\n result = []\n for vector in b:\n matrix = np.abs(a - vector)\n result.append(((matrix ** p).s...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T17:23:44.783", "Id": "259526", "Score": "2", "Tags": [ "python", "array", "numpy", "matrix", "mathematics" ], "Title": "Finding distance between vectors of matrices" }
259526
<p>I wrote a middleware for user authentication and I wanted to pass some data between authentication and request handler. What I thought would be a nice solution is to add that data into request body that then will be passed and process by handler. Here is how it looks like:</p> <pre class="lang-ts prettyprint-overrid...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T18:41:08.610", "Id": "259529", "Score": "0", "Tags": [ "javascript", "typescript", "express.js" ], "Title": "Passing data between middleware in Express.js" }
259529
<p>I have developed a function that takes a list of line segments and a rectangle that breaks the line segment into two where it encounters the rectangle. Here is a picture demonstration of what it does:</p> <p><a href="https://i.stack.imgur.com/wCd9Y.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wCd9Y.png"...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-21T06:49:06.843", "Id": "512526", "Score": "0", "body": "What will happened if the line segment intersection with the rectangle on west & south sides?" } ]
[ { "body": "<h2>General points</h2>\n<ul>\n<li><p>Use <code>const</code> when a variable does not change.</p>\n</li>\n<li><p>Avoid using underscore in JavaScript names</p>\n</li>\n<li><p>Making names too long makes code hard to read, especial when the relevant part of the name is tiny. eg <code>nIntersection, eI...
{ "AcceptedAnswerId": "259569", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T19:45:57.547", "Id": "259531", "Score": "5", "Tags": [ "javascript", "algorithm", "canvas" ], "Title": "Breaking a line segment into two where it encounters a rectangle" }
259531
<p>I managed to make a very simple contact form.</p> <p>I used PHP for server-side validation and reCAPTCHA v2.</p> <p>You can access the form at the following link: <a href="https://test.dexsolutions.digital/index.php" rel="nofollow noreferrer">https://test.dexsolutions.digital/index.php</a></p> <p>And this is the cod...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T13:54:12.553", "Id": "512028", "Score": "0", "body": "Thanks for the review, interesting article, what is a good replacement for google reCAPTCHA, and that it is easy to implement, because I am a beginner?" } ]
[ { "body": "<p>I think that your code looks fine, but have you really thought about the usage of Google's reCAPTCHA?</p>\n<p>When you include Google's reCAPTCHA in your site you're giving Google access to your site and to your visitors. If that's what you want, fine, but perhaps you shouldn't be doing this? For ...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T20:48:48.983", "Id": "259534", "Score": "3", "Tags": [ "php", "form" ], "Title": "PHP Form with reCAPTCHA v2" }
259534
<p>I have written a Python snippet that reads lat and long stored in an Excel file. Converts them to a point which is then used to perform multiple geospatial analysis including buffer, intersection, and searching within a shapefile's attribute table (finding count of a specific attribute occurrence and a single row ca...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-10T20:47:43.717", "Id": "521231", "Score": "0", "body": "Cross-posted as https://gis.stackexchange.com/q/393860/115." } ]
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T21:16:33.267", "Id": "259538", "Score": "2", "Tags": [ "python", "performance", "excel" ], "Title": "Speeding up my Python code for reading from Excel, performing geospatial analy...
259538
<p>I have a method in a service that performs a Linq-to-SQL query:</p> <pre><code>public async Task&lt;IEnumerable&lt;Incident&gt;&gt; GetIncidentsAsync&lt;TOrderBy&gt;( Expression&lt;Func&lt;Incident, bool&gt;&gt; whereExpression, Expression&lt;Func&lt;Incident, TOrderBy&gt;&gt; orderByExpression ) { retu...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T22:11:23.260", "Id": "259540", "Score": "0", "Tags": [ "linq", "linq-to-sql", "linq-expressions" ], "Title": "Make a method that uses Expression<Func<T>> for filtering and sorting...
259540
<p>I have written a program to parse a string depending on the string the user provides. Any advise/criticism is appreciated.</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdint.h&gt; #define DEFAULT_SIZE 10 #define RESIZE_MULTI 2 /*compares value to see if ...
[]
[ { "body": "<ul>\n<li><p>Major remark of the code as whole: for some reason you write the unreadable version of array access <code>*(arr+i)</code> all over the place. Don't do that! This makes your code look needlessly obscure and hard to read. Instead use the much more readable <code>arr[i]</code>.</p>\n</li>\n...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T23:04:28.513", "Id": "259541", "Score": "3", "Tags": [ "c", "strings", "array", "parsing", "matrix" ], "Title": "C string parser criticism" }
259541
<h2>Introduction</h2> <p>After finishing most of the tutorials on <a href="https://learnopengl.com/" rel="nofollow noreferrer">https://learnopengl.com/</a> I started to encapsulate code in their respective classes and started to write a mesh class and a polygon class as my first primitive geometry object to figure out ...
[]
[ { "body": "<blockquote>\n<p>Right now all meshes would have their own vertex array object even\nthough the data layout, based on FVertex, is identical between all of\nthem. Is it common to use a shared vertex array object or is the\noverhead of duplicating them negligible?</p>\n</blockquote>\n<p>If the mesh rep...
{ "AcceptedAnswerId": "259628", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-14T23:09:37.597", "Id": "259542", "Score": "1", "Tags": [ "c++", "c++17", "classes", "opengl" ], "Title": "OpenGL mesh class and derived primitive class" }
259542
<p>I've implemented my own insertion sort algorithm, and here's the code.</p> <pre><code>def insertion(lst): for i in range(1, len(lst)): for j in range(i): if lst[i] &lt; lst[j]: val = lst[i] del lst[i] lst.insert(j, val) break ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T03:09:21.650", "Id": "511989", "Score": "0", "body": "Just a style comment - if you mutate the original list, I would recommend returning `None`. I personally find it confusing when a function both modifies the input and then return...
[ { "body": "<ul>\n<li>The typical insertion sort is O(n) for already sorted input, and &quot;almost O(n)&quot; for &quot;almost sorted&quot; input. Which is somewhat common in real world data. Your way you don't have that, you're <span class=\"math-container\">\\$\\Theta(n^2)\\$</span>. Someone not familiar with...
{ "AcceptedAnswerId": "259553", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T02:01:14.440", "Id": "259545", "Score": "1", "Tags": [ "python", "algorithm", "sorting", "insertion-sort" ], "Title": "Insertion Sort- inserting from the left" }
259545
<p>Is there any way to lower the lines of this code and make it better in terms of being more Pythonic? The program collects data from <a href="https://truecar.com" rel="nofollow noreferrer"><code>truecar.com</code></a> and then puts them into my database.</p> <p>Any help would be highly appreciated.</p> <h2>Code</h2> ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T01:51:43.373", "Id": "512098", "Score": "1", "body": "This is not scraping, since you're hitting a JSON API." } ]
[ { "body": "<ul>\n<li>Write functions; currently you don't have any</li>\n<li><code>requested_car_name</code> name is deceiving (along with the <code>Enter car name</code> prompt), because this is actually being used for the car <em>make</em> parameter</li>\n<li>The fetch/prompt/fetch logic to ask for the number...
{ "AcceptedAnswerId": "259602", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T05:52:56.087", "Id": "259549", "Score": "1", "Tags": [ "python", "mysql", "web-scraping", "api" ], "Title": "Web scraping cars" }
259549
<p>I inherited the following regex:</p> <pre class="lang-regex prettyprint-override"><code> /[^.!?\s][^.!?\n]*(?:[.!?](?!['&quot;]?\s|$)[^.!?]*)*[.!?]?['&quot;]?(?=\s|$)/g </code></pre> <p>This regex is used to split sentences, and is dealing with things like quotes after periods at the end of a sentence (He said &q...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T10:15:25.390", "Id": "512125", "Score": "0", "body": "I don't think this question is answerable. You may not have documentation, however documentation is needed to be able to review code. Also I'm not sure a regular expression alone...
[ { "body": "<h3>Enlightenment.</h3>\n<p>Don't be impressed by a pattern. Format it to something readable:</p>\n<pre><code>[^.!?\\s] [^.!?\\n]*\n\n(?:\n [.!?] (?! ['&quot;]? \\s | $ )\n [^.!?]*\n)*\n\n[.!?]? ['&quot;]? (?= \\s | $ )\n</code></pre>\n<p>There are three simple parts. No madness here, this patt...
{ "AcceptedAnswerId": "259637", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T05:58:07.120", "Id": "259550", "Score": "0", "Tags": [ "regex" ], "Title": "RegEx sentence-splitting madness. Mad genius?" }
259550
<p>I want make my looped data into one flat array without associative keys. I have solved it with my code, but I think it is so crowded and not simple.</p> <p>This my code:</p> <pre><code>$data = array(); while($dt = $this-&gt;db-&gt;fetchAssoc($res_weight)){ $data[] = array_values($dt); } $datas = json_encode($dat...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T07:15:56.263", "Id": "511998", "Score": "2", "body": "We cannot fetch any data from your database, so we don't know what your data looks like. This makes, what you're doing with it, a bit of a mystery. Could you please add an data e...
[ { "body": "<p><strong>Please don't ever perform surgery on a JSON string</strong>.</p>\n<p>I see that you are trying to flatten your multidimensional indexed array of indexed arrays into an indexed array.</p>\n<p>This is far simpler, more stable, and more professionally done in your loop.</p>\n<p>First, if you ...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T06:30:48.780", "Id": "259551", "Score": "-3", "Tags": [ "php", "array", "sql", "json" ], "Title": "Form a flat indexed array from a multidimensional result set" }
259551
<p>This is my first C++ program. It would be nice if you can tell me anything I could add or do differently.</p> <p>I am new to C++ programming and I hope to learn more.</p> <pre class="lang-cpp prettyprint-override"><code>#include &lt;iostream&gt; using namespace std; int main() { float a, b, result; char op;...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T09:22:40.810", "Id": "512001", "Score": "1", "body": "Welcome to Code Review. I know it's quite obvious from your code what the program does, but would you please state the purpose of the program in the question title as well? That ...
[ { "body": "<p>there is a lot of thing you can do to further add depth:</p>\n<ul>\n<li>move the printing out of the switch</li>\n<li>display an help with current operators</li>\n<li>implements others operator (pow(), sin(), square(), root()...), you'll then have to check the number of arguments</li>\n<li>use a s...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T08:54:19.630", "Id": "259555", "Score": "4", "Tags": [ "c++", "beginner", "calculator" ], "Title": "First C++ calculator" }
259555
<p>I was asked to program the following:</p> <p>Develop a two-player dice game that will have the players roll two 6-sided dice each and get points depending on what they roll. There are 5 rounds in a game. In each round, each player rolls the two dice. The rules are:</p> <ul> <li>The points rolled on each player’s dic...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T10:26:09.603", "Id": "512003", "Score": "0", "body": "Sorry, not gonna read all that. Review = Use a loop." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T16:14:33.540", "Id": "512040", "Score...
[ { "body": "<p>There's a lot to work through here. I focused on <em>taking the next step</em> when improving the code, not fully rewriting it the way I personally would. I would recommend you work through the points and the resulting code, try to understand and apply these principles. Afterwards you're welcome t...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T10:01:59.123", "Id": "259557", "Score": "2", "Tags": [ "python", "performance" ], "Title": "2 player dice game, 5 rounds, points system" }
259557
<p>I have a simple golang app in which I have two background tasks that produce data,each of them use it's own channel to signal it produced another unit of data.</p> <p>I have a single consumer that needs the data form the two other background tasks as input in a 1-to-1 ratio. What I want to do,for the lack of a bette...
[]
[ { "body": "<p>&quot;Actually you code is pretty much this. Simple and boring as most other good Go code&quot; <strong>I thought.</strong></p>\n<p><strong>At this point I could say</strong> &quot;Wrap your c &lt;- true with a select statement, add the third case &lt;-ctx.Done: to handle possible deadlock and you...
{ "AcceptedAnswerId": "259919", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T10:03:32.643", "Id": "259558", "Score": "4", "Tags": [ "go", "concurrency" ], "Title": "Intersect channels in Go" }
259558
<p>I have been working on creating a scraper that auto detects if there is any changes on a website as example as there is a release date or a increas/decrease of size value.</p> <p>I have created couple of files where I have:</p> <p><strong>product_monitoring.py</strong> - The brain behind to check if there is any res...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:03:24.943", "Id": "512064", "Score": "0", "body": "I'm not sure the code is ready for review, with the amount of placeholders I see." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T13:08:00.777", ...
[ { "body": "<h2>Exceptions</h2>\n<p>Your exception handling is... a little convoluted. The exception handlers in <code>monitor_stock</code> that all pass <code>allowed_count=0</code> should not have to go through your <code>ExceptionCounter</code> machinery at all. Instead, re-raise with contextual data in a cus...
{ "AcceptedAnswerId": "259622", "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T11:48:51.407", "Id": "259561", "Score": "2", "Tags": [ "python-3.x", "web-scraping" ], "Title": "Check if new dict values has been added" }
259561
<p>I had a problem at my work that we have some tasks that need to be executed as fast as possible. To do this we implemented them so they are multi-threaded in an ExecutorService. Originally we had for each different type of task a different ExecutorService (simple Executors.newFixedThreadPool(cpuCount)). However, the...
[]
[ { "body": "<p>Starting with the requirements it's not clear to me why &quot;instead of having all threads running at the same time, we wanted them to timeout.&quot;</p>\n<p>If I understand your goal correctly, you want to implement rate limiting on an executor. It could be used to optimize throughput and mitiga...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T11:51:21.463", "Id": "259562", "Score": "3", "Tags": [ "java", "multithreading", "inheritance", "delegates" ], "Title": "Pool of Thread Pools" }
259562
<p>I have written my first react js web app. It is a portfolio project which is a restaurant website. I have used firebase to authenticate users and to host my website. I am asking the Code Review community to kindly review my code if there are scopes for improving and refactoring the code.</p> <p>And I faced three pro...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T11:58:41.377", "Id": "259563", "Score": "1", "Tags": [ "react.js", "firebase" ], "Title": "My First React JS Portfolio Web App : A Restaurant Website" }
259563
<p>I was wondering if anyone would be able to review my Grade Calculator for a course ERD? I'm looking for ways to improve the current design (if any improvements need to be made that is) and if anyone could review the current MySQL query which is there. In order for this to be reviewed I was told I needed an SQL query...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T15:01:16.283", "Id": "512033", "Score": "0", "body": "In addition to your diagram can you post the actual DDL?" } ]
[ { "body": "<p>I've got a few thoughts:</p>\n<ol>\n<li><p>The user table is related to the course table in a funny way. At first when I was looking at the diagram I assumed users were students, but after staring for a while, that seemed less and less likely. I'm now under the impression that the user is the owne...
{ "AcceptedAnswerId": "259571", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T12:16:58.013", "Id": "259564", "Score": "0", "Tags": [ "mysql", "database" ], "Title": "Entity Relationship Diagram for Grade Calculator" }
259564
<h1>Sᴀᴍ Onᴇᴌᴀ</h1> <p>I've been a member of this community for 4.5 years and made Code Review part of my daily routine. I regularly participate in <a href="https://chat.stackexchange.com/rooms/info/8595/the-2nd-monitor">the 2nd monitor</a> as well as the review queues. I do what I can to keep posts clean and on-topic, ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:49:36.960", "Id": "512072", "Score": "0", "body": "One more participation badge needed to reach a perfect candidate score! Go get the badge!" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T22:41:55...
[]
{ "AcceptedAnswerId": null, "CommentCount": "9", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T12:32:46.277", "Id": "259565", "Score": "0", "Tags": null, "Title": null }
259565
<p>Recent i started my fist &quot;real&quot; project. My goal is to code the first gen of Pokemon in Java. I have higly oriented my code on a YouTube viedo (<a href="https://www.youtube.com/watch?v=dEKs-3GhVKQ&amp;list=PLah6faXAgguMnTBs3JnEJY0shAc18XYQZ&amp;index=1" rel="nofollow noreferrer">https://www.youtube.com/wat...
[]
[ { "body": "<p>While testing your code, I found that the figure moves on a grid that doesn't actually exist. As such, I found myself running into signs, even though my figure was mostly above the sign. I also noticed that if you click quickly on the WASD keys, the figure doesn't move.</p>\n<p>There's a few thing...
{ "AcceptedAnswerId": "259590", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T12:45:41.710", "Id": "259567", "Score": "3", "Tags": [ "java", "game", "pokemon" ], "Title": "Tile based movement game in Java 2D" }
259567
<p>I'm trying to solve the 15 Puzzle problem using IDA* algorithm with a Linear Conflicts heuristic. I already implemented the heuristic from what I understood : <a href="https://medium.com/swlh/looking-into-k-puzzle-heuristics-6189318eaca2" rel="nofollow noreferrer">link</a></p> <p>Here's my goal state (&quot;snail&qu...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T14:22:36.293", "Id": "259570", "Score": "1", "Tags": [ "performance", "algorithm", "python-3.x", "sliding-tile-puzzle", "heuristic" ], "Title": "Linear conflicts heuristic...
259570
<h1>Thomas Ward</h1> <p>My name is Thomas Ward, and I'm putting my name in to become a moderator on Code Review.</p> <p>I'm a very good Python coder, and do that regularly for my Day Job. This said, I have low post activity because most of my code is either proprietary and unable to be shared, or I just don't want tha...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T18:25:17.437", "Id": "512235", "Score": "1", "body": "Hi, Why do you want to be a moderator on more than one website ?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T14:43:27.507", "Id": "512270"...
[]
{ "AcceptedAnswerId": null, "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T14:46:23.410", "Id": "259572", "Score": "0", "Tags": null, "Title": null }
259572
<p>I'm writing a VBA program which copies and organizes data from one master sheet into numerous other sheets. One of the recipient sheets unifies all the data from the master sheet which holds the same id number into a single row. For this operation, I am looping through the master sheet for each id number, copying ea...
[]
[ { "body": "<p>Some comments that you hopefully find useful:</p>\n<ol>\n<li>(Best Practice)Declare &quot;Option Explicit&quot; at the top of every module. This option requires that every variable used in the module is explicitly declared. Doing so avoids numerous errors, not the least of which are <em>new-vari...
{ "AcceptedAnswerId": "259621", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T16:25:51.700", "Id": "259580", "Score": "2", "Tags": [ "vba", "excel" ], "Title": "Best way to copy data to a new sheet and reorganize it (VBA)" }
259580
<p>I am have made a small copy-to-clipboard script.</p> <p>I have made a method called <code>copyToClipboard</code> that does the following:</p> <ol> <li>create an input box;</li> <li>read the content of an HTML element;</li> <li>set the input box value to the content previously read;</li> <li>append the input box to a...
[]
[ { "body": "<h2>Style</h2>\n<p>I can not fault the style and layout.</p>\n<p>The need to call <code>init</code> which is an indirect call to <code>handleClick</code> seams redundant. Do it in the constructor.</p>\n<p>I am puzzled as to why you set <code>readonly</code> to <code>''</code> (<code>el.setAttribute('...
{ "AcceptedAnswerId": "259615", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T16:58:09.437", "Id": "259581", "Score": "2", "Tags": [ "javascript", "object-oriented", "ecmascript-6", "event-handling" ], "Title": "JavaScript copy-to-clipboard class" }
259581
<p>I have a small and weak microcontroller. I also don't have access to the complex library. I wrote this iterative version of the FFT to hopefully get better performance than the recursive version, and also just to learn how the FFT works, and brush up on C.</p> <p>I'd like to know if the code itself is understandable...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T18:54:13.183", "Id": "512063", "Score": "1", "body": "And, is it faster than the recursive version? If you don't know, benchmark it." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:46:46.797", ...
[ { "body": "<h1>Missing <code>const</code></h1>\n<p>I see you sprinkled <code>const</code> almost everywhere. However, you actually missed the one spot where it actually matters most: <code>input</code> should be a <code>const</code> pointer:</p>\n<pre><code>_Bool fft(const complex_t* input, complex_t* output, c...
{ "AcceptedAnswerId": "259597", "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T17:39:37.077", "Id": "259585", "Score": "9", "Tags": [ "performance", "c" ], "Title": "Iterative Radix-2 FFT in C" }
259585
<h1>pacmaninbw</h1> <p>I came to the Code Review Community 5+ years ago to improve my C++ abilities (I was told during a job interview that it looked too much like C code). I stayed because I found a community that I belonged in.</p> <p>My Bachelor of Science is in Computer Science and I have been coding for 40 years. ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T23:26:10.587", "Id": "512095", "Score": "0", "body": "In your answer to question 8 you say that: \"This is concerning about existing comments and answers, there may be answers and comments I posted years ago (prior to certain Stack ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T18:12:32.333", "Id": "259587", "Score": "0", "Tags": null, "Title": null }
259587
<h1>Peilonrayz</h1> <p>As a moderator I would primarily be a 'meta moderator'. My aim is to be a proxy for the community to make the changes the site feels need to be made. Whether we want to change close reasons, make or break synonyms or edit the help center. Whatever you, the community, decides is what I'll try to m...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:48:57.153", "Id": "512071", "Score": "0", "body": "One more moderation badge needed to reach a perfect 40/40 candidate score! Go get the badge!" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:52...
[]
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T18:46:48.653", "Id": "259591", "Score": "0", "Tags": null, "Title": null }
259591
<p>This is a sparse matrix (dgCMatrix) class that extends Rcpp.</p> <p><strong>WHAT:</strong> This class includes <code>Rcpp::NumericVector</code> and <code>Rcpp::NumericMatrix</code> classes which are simple references to R objects. This class fully supports reference-only no-copy conversion of the <code>Matrix</code>...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T19:17:54.667", "Id": "259594", "Score": "2", "Tags": [ "c++", "matrix", "iterator", "r", "rcpp" ], "Title": "Rcpp sparse CSC matrix class" }
259594
<p>I have 3 nested loops and they do the following:</p> <ol> <li>Get scopes from DHCP</li> <li>Get hostnames from csv file</li> <li>Compares hostnames and leases, matches are added to a hash table</li> </ol> <p>There are 5 DHCP servers, 100's of scopes and thousands of leases.</p> <p>What would be a good method to spee...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T20:41:16.277", "Id": "512076", "Score": "1", "body": "Welcome to Code Review! I [changed the title](https://codereview.stackexchange.com/revisions/259596/2) so that it describes what the code does per [site goals](https://codereview...
[ { "body": "<p>Piping the DHCP calls through <code>foreach-object</code> instead and then comparing at the end, cut the time down from 3min to 1min. Everything I have read made it seem like <code>foreach</code> was faster. Having DHCP being processed down the pipe with <code>foreach-object</code> instead of seve...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-15T20:26:59.173", "Id": "259596", "Score": "0", "Tags": [ "performance", "csv", "powershell" ], "Title": "Compare hostnames and leases between CSV and DHCP info" }
259596
<p>TLDR: Is my code following best practices for OOP and PyQt5 regarding inheritance, and is it okay to initialise classes within another class? What can I do to improve my methods, or what would be a better approach to my specific problem?</p> <p>I'm very new to OOP and PyQt5. My Code creates a GUI with 2 tab widgets,...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T03:49:05.663", "Id": "259604", "Score": "3", "Tags": [ "python", "python-3.x", "pyqt" ], "Title": "PyQt5 developing complex Window GUI and making everything its own class" }
259604
<p>I have a pretty simple method that grabs data from an sql query and then puts it inside of a list and finally iterates through two for each loops onto an excel file. It works fine with small amounts of data, but not at all with larger amounts. What would be the best way to iterate and also write to my workbook the q...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T06:04:28.427", "Id": "512110", "Score": "0", "body": "Apologies this is openxml" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T06:51:56.277", "Id": "512111", "Score": "1", "body": "Welcom...
[ { "body": "<p>Quick remarks:</p>\n<ul>\n<li><p>I don't see the point of <code>listofCoreBankingIds</code>, especially since you only use the <code>key</code>, never the <code>value</code>. Just loop through the <code>currentRecordList</code>. I'm guessing you might need to <code>GroupBy</code> the <code>CoreBan...
{ "AcceptedAnswerId": "259609", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T05:11:14.323", "Id": "259605", "Score": "3", "Tags": [ "c#", "excel" ], "Title": "How to iterate through data and write to excel file quicker with C# and openXML" }
259605
<p>I originally posted this on StackOverflow but was requested to post it here instead as it relates to optimization/performance of the code rather than a specific problem.</p> <p><strong>TL;DR:</strong> Get-Random produces an even distribution of numbers where every number in the pool has an even chance of appearing. ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T13:47:01.223", "Id": "512134", "Score": "1", "body": "you could try breaking your range into batches and then generating numbers for each new sub-range. ///// as an aside, the `-Maximum` parameter is EXCLUSIVE. that means `-min 1 -m...
[ { "body": "<blockquote>\n<p>Since you tagged your question with <code>Performance</code>, my example is not totally idiomatic PowerShell.</p>\n</blockquote>\n<p>You could build a lookup array with each number as many times as you have defined the probability for them.</p>\n<p>Afterwards you can easily index int...
{ "AcceptedAnswerId": "259651", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T06:10:35.147", "Id": "259606", "Score": "0", "Tags": [ "performance", "powershell" ], "Title": "Creating a specific distribution of random numbers in Powershell" }
259606
<p>How can the following method be flattened? I tried to pipe all the operators to the first pipe (from(<code>this.fireAuth.currentUser</code>)) but I lost access to the previous variables. It's an Angular HTTP interceptor that adds a Bearer Token when the user has logged in, the chain should continue as usual when th...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-05-28T08:19:28.667", "Id": "515679", "Score": "0", "body": "Please [edit] your question so that the title describes the *purpose* of the code, rather than its *mechanism*. We really need to understand the motivational context to give goo...
[ { "body": "<p>Your specific example can be simplified by treating the non-observables as simple variables, eg:</p>\n<pre><code>intercept(\n request: HttpRequest&lt;any&gt;,\n next: HttpHandler\n): Observable&lt;HttpEvent&lt;any&gt;&gt; {\n \n const user = this.fireAuth.currentUser; \n if (!user) return n...
{ "AcceptedAnswerId": "261282", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T12:33:22.193", "Id": "259618", "Score": "0", "Tags": [ "typescript", "angular-2+", "rxjs" ], "Title": "RxJs - Flat nested swithMaps and pass variables on Http interceptor" }
259618
<p>I want to start making some command line programs in C, this is a fork of something else I made but is more suitable to this site. My big question is there a better way to pipe commands? I think the way I did it feels improper. I especially feel the string method is a bit hacky.</p> <pre class="lang-c prettyprint-ov...
[]
[ { "body": "<h1>General Observations</h1>\n<p>This code should work just fine, but performance can be enhanced.</p>\n<h1>Initialize Arrays to Zero at Compile Time</h1>\n<p>Currently there is a performance hit in the code when initializing the array <code>t</code> to zero. The function <code>memset()</code> is a ...
{ "AcceptedAnswerId": "259625", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T12:42:08.283", "Id": "259619", "Score": "1", "Tags": [ "c", "strings", "console" ], "Title": "C scrabble counter with piping input" }
259619
<p>Started learning C++ a few weeks ago, tried to accurately simulate a Pokemon battle. Not too optimistic how it turned out, please tell me how I could improve it.</p> <p>Only the bare minimum(damage, accuracy, type effectiveness) are implemented, items weather etc are not.</p> <p>typechart.h:</p> <pre><code>#pragma o...
[]
[ { "body": "<p>Hello i think you should read data from a file instead of putting it in code so you can tweak balance without recompiling, if you fear the lack of readability in code, juste add a single comment where is appropriate.</p>\n<p>You also could use Enum for pokemon type.\nI was a bit confused by Move, ...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T17:31:13.257", "Id": "259627", "Score": "8", "Tags": [ "c++", "beginner", "battle-simulation", "pokemon" ], "Title": "Pokemon battle simulation" }
259627
<p>I've made a code that does exactly what <a href="https://sapin.herokuapp.com/?n=5" rel="nofollow noreferrer">https://sapin.herokuapp.com/?n=5</a> would do.</p> <p>Here's my code ;<br></p> <pre><code>import sys def firtree(tree_size): fir = [] width = 1 minus = 2 foot_width = 1 for i in range(1,t...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T20:13:25.870", "Id": "512181", "Score": "1", "body": "English variable and function names would make it easier for contributors to understand and analyse your code." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate":...
[ { "body": "<p>Use comments to guide the reader through the major phases of the algorithm.\nImagine returning to this code to fix a bug or add a feature. Simple comments\ncan help you zero in on the needed location to do that work.</p>\n<p>Centralize the creation of literal parameters (see <code>space</code>, <c...
{ "AcceptedAnswerId": "259644", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T18:20:48.383", "Id": "259631", "Score": "2", "Tags": [ "python" ], "Title": "Python fir tree maker" }
259631
<p>I implemented as an exercise a function which maps over object values in Typescript, and I am truly horrified by my type annotations.</p> <p>The function:</p> <pre class="lang-js prettyprint-override"><code>type map = &lt;F, T&gt;(f:callback&lt;F, T&gt;) =&gt; mapping&lt;F, T&gt;; type callback&lt;F, T&gt; = (value:...
[]
[ { "body": "<p>It would be much easier for TS to infer the types if you put your callback in second place.</p>\n<p>I mean <code>const map = obj =&gt; f =&gt; {}</code></p>\n<p>Also I slightly refactored your function in order to reduce complexity:</p>\n<pre class=\"lang-js prettyprint-override\"><code>type Primi...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T18:33:15.333", "Id": "259632", "Score": "2", "Tags": [ "reinventing-the-wheel", "generics", "typescript" ], "Title": "Generic Object mapping function" }
259632
<p>I am learning React by doing a Contact Manager, I am trying to write this code more efficiently. Any ideas...good practise, component splitting, formatting tips are accepted too. Thanks in advance</p> <p>P.S. Sorry for my English...I am from Italy.</p> <p>First I used a separate function for everything, then I trans...
[]
[ { "body": "<p>Don't add extra properties to the component for things that belong in state. Delete <code>this.people</code> because you already have <code>this.state.people</code>. Move <code>i</code> into state.</p>\n<p>Of course if you do that you cannot use mutating operations like <code>++</code> and <code...
{ "AcceptedAnswerId": "259886", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T18:38:44.617", "Id": "259633", "Score": "1", "Tags": [ "beginner", "formatting", "react.js" ], "Title": "Is there a cleaner/better way to write this Contact Manager in React?"...
259633
<p>I created a simple text to morse code converter in python, and was wondering if there was an easier/shorter way to do this. Is there a way to generate the dictionary without having to hard-code every single option?</p> <pre><code>def main(): print(&quot;This program translates words to morse code\n&quot;) ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T20:28:42.573", "Id": "512182", "Score": "1", "body": "I don't know about a *generator*, but why do you need a createDict() function if it's a static dict with specific letter-to-code mappings? Just define it as a variable in your c...
[ { "body": "<blockquote>\n<p>NOTE: You do not specify a Python version, so I am assuming you are using a recent version of Python - I use Python 3.9 personally so I'm writing with this in mind as an assumption. I've written this answer to be compatible with Python 3.6 and newer, there's a spot where I give a wo...
{ "AcceptedAnswerId": "259638", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T19:52:40.387", "Id": "259634", "Score": "7", "Tags": [ "python", "morse-code" ], "Title": "Simple Morse Code Converter (Python)" }
259634
<p>I created a &quot;2-player&quot; rock-paper-scissors game in Python mainly using if statements and a single while loop. The program is really simple, but I was wondering if using switch statements or perhaps another format would make it less cluttered/quicker/etc.</p> <pre><code>again = 'y' while (again == 'y'): ...
[]
[ { "body": "<h3>Remove Redundant Parenthesis</h3>\n<p>In this line:</p>\n<pre><code>while (again == 'y'):\n</code></pre>\n<p>The parenthesis are unneeded and can (should) be removed.</p>\n<h3>Use a dict to drive the stacked if/else</h3>\n<p>Whenever I see a stacked if/else I look to restructure the code using a ...
{ "AcceptedAnswerId": "259672", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T20:54:52.860", "Id": "259635", "Score": "4", "Tags": [ "python", "rock-paper-scissors" ], "Title": "2 Player Rock Paper Scissors (Python)" }
259635
<p>I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university course.</p> <p>This project is a brainfuck interpreter, for which I used nothing but the wiki article on brainfuck (i.e., ...
[]
[ { "body": "<h1>About your concerns</h1>\n<blockquote>\n<p>This project is a brainfuck interpreter, for which I used nothing but the wiki article on brainfuck (i.e., no foreign design or code, apart from <code>whileM</code>). It was eye-opening in some regards, because I finally used and designed monadic operati...
{ "AcceptedAnswerId": "259951", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T20:55:04.023", "Id": "259636", "Score": "7", "Tags": [ "haskell", "functional-programming", "brainfuck", "monads", "state" ], "Title": "A beginner's brainfuck interpre...
259636
<p>I wrote a program to find all the prime numbers up to <code>N</code> on my TI-84, however, it is quite slow for any number above, like, 50. Are there any ways to optimize my code?</p> <p>(I added comments using <code>//</code>)</p> <pre><code>Input N {2}→L₂ For(I,3,N,2) // Loop through every odd number up to N start...
[]
[ { "body": "<p>For factorization, the state of the art (as of like 1999, but also today as far as I know) is something like Rob Gaebler's ABIGSIV: <a href=\"https://www.ticalc.org/archives/files/fileinfo/79/7923.html\" rel=\"nofollow noreferrer\">https://www.ticalc.org/archives/files/fileinfo/79/7923.html</a></p...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-16T22:54:45.970", "Id": "259642", "Score": "2", "Tags": [ "primes", "ti-basic" ], "Title": "Optimize TI-BASIC Prime Numbers Finder" }
259642
<p>I was thinking about how unit tests require you to manually instantiate all your dependencies, even though many of them are the same for every test or don't really matter (such as logging, where people usually just inject mocks). As a possible solution to this problem, I wrote a unit test framework that injects any ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-19T08:42:50.597", "Id": "512319", "Score": "0", "body": "Are you expecting to review your whole project?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-20T12:47:43.250", "Id": "512444", "Score": "0...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T00:46:06.403", "Id": "259645", "Score": "5", "Tags": [ "c#", "unit-testing", "integration-testing", "visual-studio" ], "Title": "SmartUnit: Unit Testing with DI" }
259645
<p>I'm pretty new to Powershell but have been using it more and more to automate tasks at work. Now I'm reaching out for some help. I typically use the scripts I write in a way where I copy and paste the ps1 into the directory I want to perform the task on. Then double-clicking. That is why you'll see that the ps1 file...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T01:26:00.683", "Id": "259647", "Score": "0", "Tags": [ "performance", "multithreading", "file-system", "formatting", "powershell" ], "Title": "Powershell Refolder by Filen...
259647
<p>Most concerned with improving efficiency and eliminating redundancy than anything else. a lot of Dominos rules have not been implemented yet. Any form of feedback is appreciated.</p> <pre><code>from itertools import combinations_with_replacement from random import sample, choice def get_starting_board(): domin...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T02:31:54.623", "Id": "259648", "Score": "0", "Tags": [ "python", "functional-programming" ], "Title": "Dominos [Python] CLI Game" }
259648
<p>I use the following code which works and install helm chart (in the loop) in parallel, it get a <code>kubeconfig</code> file (to access to k8s) create a helm client and install the charts from the defined location and waits (<code>upgradeAction.Wait = true</code>) that each chart installation will finished successfu...
[]
[ { "body": "<ol>\n<li>The code is ignoring the return values from the go routine</li>\n<li>The WorkGroup isn't used to block until completion</li>\n</ol>\n<pre><code>// 1. Perhaps you'd want to have a separate channel to communicate the errors.\nvar errCh := make(chan error, len(charts))\nfor _, chartInstallatio...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T06:16:48.220", "Id": "259652", "Score": "2", "Tags": [ "beginner", "go" ], "Title": "Installing charts in parallel using go routines" }
259652
<p>I created an rxjs search for a hiring company, but I got rejected for the following reason: -performance issue on a bigger data set. -bugs</p> <p><strong>My question is how can I make this code better for the next time if I have similar task?</strong></p> <p>brands = These should be populated from the brand propert...
[]
[ { "body": "<p>If there are 1 million datasets, and i enter the first three letters, it will have to filter all 1 millionen values (let us asume the result will be 200 hits). When i now add a fourth letter, it will have to filter AGAIN all 1 million values and not just the 200 hits.</p>\n<p>Therefor, if it is ab...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T06:39:30.427", "Id": "259653", "Score": "2", "Tags": [ "typescript", "search", "angular-2+", "rxjs" ], "Title": "Rxjs search in Angular" }
259653
<h1>Hello Everyone!</h1> <p>Fellow human beings, today I present to you my dice rolling script! Behold, in my amateurish attempt at some raw C# code. Perhaps this will remain here regardless of the dozens of other dice rolling scripts out there.</p> <h3>Contains a 'for' loop, a 'switch', and a method that returns a val...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-19T23:17:44.137", "Id": "512385", "Score": "0", "body": "*regardless of the dozens of other dice rolling scripts out there*. [Here is a CR thread about dice that I happen to be familiar with](https://codereview.stackexchange.com/a/3...
[ { "body": "<p>Welcome to CR. While I do appreciate your enthusiasm and willingness to learn, your first attempt here is fairly lacking. To give that a more positive spin, let's say there are plenty of opportunities for improvement.</p>\n<p>The good news is indentation is very nice. And you use <code>{ }</cod...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T08:23:19.337", "Id": "259656", "Score": "4", "Tags": [ "c#", "random", "dice" ], "Title": "This code is a non-static C# class for rolling a number of dice" }
259656
<p>I need to change the page title based on the current state of my store. Right now I came up with</p> <pre><code>const useTitle = () =&gt; { const { foo, bar } = useSelector(selectFoorBar); const baz = useSelector(selectBaz); const fooBarDisplayString = format(foo, bar); const barDisplayString = (bar ?? 0).t...
[]
[ { "body": "<p>I don't see any issue with the code.</p>\n<blockquote>\n<p>It's technically a hook, because it's using other hooks, so it must\nstart with use keyword. That feels weird to somebody coming outside of\nthe React world like me. Furthermore, it doesn't return any title...</p>\n</blockquote>\n<p>The <c...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T11:19:24.713", "Id": "259658", "Score": "3", "Tags": [ "beginner", "react.js" ], "Title": "My first React custom hook" }
259658
<p>I have this work task, to write a SQL query that would show how many of the active customers are new (= do not have prior transactions) as opposed to returning per a given period.</p> <p>There is nothing particular in the DB to get this, so my solution takes a transaction and compares <code>customer_id</code> to the...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-13T18:56:09.933", "Id": "519137", "Score": "0", "body": "This question is pretty old so may be irrelevant now, but if you still want an opinion on it, post the query plan for that query and say what indexes there are on that table, inc...
[ { "body": "<p>I had some troubles reading your query, but I think I got it, please tell me if not.\nBasically you want a report per week of total customers vs new customers, right?</p>\n<p>I did a query that seems a bit more performant, please have a look and let me know if your requirements are accomplished:</...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T11:30:18.093", "Id": "259659", "Score": "2", "Tags": [ "sql", "postgresql" ], "Title": "Getting new vs. returning customers in Postgres" }
259659
<p>Here is the problem:</p> <blockquote> <p>Given an array of a non-continuous sequence of dates. Make it a continuous sequence of dates, by filling in the missing dates.</p> </blockquote> <pre><code># Input dates = np.arange(np.datetime64('2018-02-01'), np.datetime64('2018-02-25'), 2) print(dates) #&gt; ['2018-02-01...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-20T04:03:50.340", "Id": "512394", "Score": "0", "body": "What's the last `2` supposed to indicate in `dates`, the amount of entries? The gap?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-20T10:20:17.837"...
[ { "body": "<p>As you will be able to see from your provided sample input, your code does not produce the intended result. Here is a minimal example:</p>\n<pre><code>dates = np.arange(np.datetime64('2018-02-01'), np.datetime64('2018-02-05'), 2)\nstride = (dates[1] - dates[0])\nresult = np.arange(np.datetime64(da...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T12:04:53.830", "Id": "259661", "Score": "0", "Tags": [ "python", "array", "datetime", "numpy" ], "Title": "Fill missing dates into array of np.datetime" }
259661
<p>So i created a social media website in django and here is how i managed accepting friend requests and showing friends posts in home page.</p> <p>Would it be better to do this operation in models.py file, create a function and call it in views using django forms? My concern is security</p> <pre><code>def home(request...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T12:54:02.280", "Id": "512215", "Score": "0", "body": "In the future please make the title describe what the code does rather than your concerns about the code. Please read [How do I ask a good question?](https://codereview.stackexch...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T12:07:35.017", "Id": "259662", "Score": "0", "Tags": [ "python", "django" ], "Title": "Managing friend requests on a social media website in Django" }
259662
<p>I wrote a python program to find if a matrix is a magic square or not. It works, but I can't help feeling like I may have overcomplicated the solution. I have seen other implementations that were a lot shorter, but I was wondering how efficient/inefficient my code is and how I could improve it and/or shorten it to a...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T17:45:24.767", "Id": "512230", "Score": "0", "body": "Seems wrong, as it claims that `[[1,1,1], [1,1,1], [1,1,1]]` is a Lo Shu Magic Square." } ]
[ { "body": "<p>Your solution is hardcoded for matrices of size 3x3 - why not support matrices of arbitrary size as well? It's also difficult to maintain and debug your code, i.e., it's easy to mess up somewhere when you are indexing your rows and columns. Also, imagine you wanted to consider larger matrices: wha...
{ "AcceptedAnswerId": "259666", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T15:41:45.807", "Id": "259665", "Score": "1", "Tags": [ "python", "performance", "matrix", "mathematics" ], "Title": "Lo Shu Magic Square (Python)" }
259665
<p>I have written a code to replace all spaces in a <code>String</code> with <code>%20</code>.</p> <pre><code>Input: &quot;Mr John Smith &quot; Output: &quot;Mr%20John%20Smith&quot; </code></pre> <p>My logic:</p> <pre><code>public class URLify { public static void main(String[] args) { String str = &quot;Mr...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T17:57:34.873", "Id": "512231", "Score": "0", "body": "What was the language for the given solution?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T18:09:07.080", "Id": "512232", "Score": "0",...
[ { "body": "<h2>Review</h2>\n<p>Welcome to Code Review. There are some suggestions as follows.</p>\n<h3>Consider to use <code>replaceAll</code></h3>\n<p>The operation you performed is what <a href=\"https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String)\"...
{ "AcceptedAnswerId": "259678", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T17:39:55.407", "Id": "259667", "Score": "1", "Tags": [ "java", "strings", "comparative-review", "complexity" ], "Title": "URLify a given String - replace spaces with %20" ...
259667
<p>I built a small flask app and a lot of routes do need some kind of pagination system. However, in some cases I would like to just display <code>n-2, n-1, n, n+1, n+2</code> where n is the current page and in some others cases, probably a bigger range. Fo example, in the following picture, the range is <code>2</code>...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T19:02:25.340", "Id": "259671", "Score": "0", "Tags": [ "python", "object-oriented", "design-patterns", "flask" ], "Title": "Python - Pagination class" }
259671
<pre class="lang-c prettyprint-override"><code>// generate a random &quot;walk&quot; of letters from A to Z in a 2D grid, assuming a // character set with contiguous values of uppercase letters (e.g. ASCII); // stops if the &quot;walker&quot; gets stuck // example of a successful walk: // A . . . I J K . . ...
[]
[ { "body": "<h1>Answers to your questions</h1>\n<blockquote>\n<p>I've read that functions shouldn't normally take more than 2–3 parameters</p>\n</blockquote>\n<p>I wouldn't worry about that too much. If you do have lots of parameters though, you should think about whether they are really necessary, and perhaps i...
{ "AcceptedAnswerId": "259688", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T20:58:42.763", "Id": "259674", "Score": "8", "Tags": [ "c", "c99" ], "Title": "Random walk on a grid" }
259674
<p>I have a program that gives the player a random U.S. state, asks for its capital, and keeps score. This keeps going until the player decides to stop playing. At the end, it prints out both the amount of correct answers and amount of incorrect answers.</p> <p>I took some of the advice into account that I got on my ot...
[]
[ { "body": "<p>You are on the right track in several respects -- for example, putting all\nbehavior/actions inside of functions. That said, constants are fine at the top\nlevel, and one advantage of putting them there is allowing the reader to\nfocus on the algorithm without the visual heaviness of a big data st...
{ "AcceptedAnswerId": "259681", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-17T23:14:19.553", "Id": "259676", "Score": "6", "Tags": [ "python", "quiz" ], "Title": "U.S. State Capitals Quiz (Python)" }
259676
<h3>Objective:</h3> <ul> <li>Create a function to sum a list of fractions (represented as pairs)</li> </ul> <h3>Rules</h3> <ul> <li>Only Prelude functions allowed</li> </ul> <h3>Notes</h3> <ul> <li>I was debating if I should create a <code>Fraction</code> data type. Is it worth &quot;upgrading&quot; from a simple pair?...
[]
[ { "body": "<p>There are two things that in my opinion would make your code easier to follow.</p>\n<ol>\n<li>The sum of zero numbers can be (and is usually) defined as zero, which is the identity element <code>0</code> of addition in the sense that\n<span class=\"math-container\">$$ x = 0 + x = x + 0$$</span>\nh...
{ "AcceptedAnswerId": "259704", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T06:04:10.713", "Id": "259685", "Score": "0", "Tags": [ "haskell", "reinventing-the-wheel", "mathematics" ], "Title": "Sum of fractions" }
259685
<p>I need a review and best practice approach to do something like that:</p> <pre class="lang-bsh prettyprint-override"><code>#!/bin/bash screenshots(){ while read line; do ./getscreenshot.sh &quot;$line&quot; &amp; done &lt; subdomains.txt } screenshots &amp; anotherfunc wait </code></pre> <p>Note mu...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T06:17:50.990", "Id": "259686", "Score": "0", "Tags": [ "bash", "asynchronous", "linux" ], "Title": "Multiple async wait" }
259686
<p>I have developed <a href="https://github.com/muazsh/Mockingbird" rel="nofollow noreferrer"><strong>Mockingbird</strong></a> a mocking framework for c++, it depends on function injection, here is the code from the repository:</p> <pre class="lang-cpp prettyprint-override"><code>/* * Mockingbird is a simple and a po...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-19T20:09:57.040", "Id": "512370", "Score": "0", "body": "@pacmaninbw I see, in this case what about the license once I post my code in here, I have read some questions like [this](https://meta.stackoverflow.com/questions/315413/does-st...
[ { "body": "<p>You make the code really hard to read:</p>\n<pre><code>#define INJECTION_SET(FuncName, Substitute)\\\nprivate:\\\ntemplate&lt;class T&gt;\\\nclass FuncName##Class {\\\npublic:\\\nFuncName##Class():m_func((T)Substitute){}\\\nT m_func;\\\n};\\\nFuncName##Class&lt;decltype(Substitute)&gt; m_##FuncNam...
{ "AcceptedAnswerId": null, "CommentCount": "7", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T15:01:22.473", "Id": "259694", "Score": "2", "Tags": [ "c++", "framework", "mocks" ], "Title": "Mockingbird c++ mocking framework" }
259694
<p>I wrote a simple Java bank application and I would like to get an review! I learned today about exceptions, so I tried to apply it on my code, but sadly I couldn't made it. I hope someone here could help me with that.</p> <h3>Account.java</h3> <pre><code>private final String firstName; private final String lastName;...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T19:33:17.953", "Id": "512291", "Score": "1", "body": "It's easier to review your code if you include the class definitions from your source files. It means there's less work required if somebody wants to run your code locally." }...
[ { "body": "<p>Than you for sharing your code.</p>\n<p>I think you did a good job and there are only minor things to mention:</p>\n<h2>odd property manipulations</h2>\n<p>In some of your <em>getter</em> method you add an empty String (<code>&quot;&quot;</code>) to the property value. Why do you do that? The Stri...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T16:11:04.260", "Id": "259695", "Score": "6", "Tags": [ "java" ], "Title": "Simple bank application in Java" }
259695
<p>I was going through the book <code>Hands on Machine Learning With Scikit-Learn &amp; Tensorflow</code>. In one of the chapters, the author mentioned <code>stacking</code> ensemble methods. I tried implementing my own for practice purpose, this is what I have done so far.</p> <pre><code>from sklearn.base import BaseE...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T19:10:50.403", "Id": "512290", "Score": "0", "body": "OK, but what exactly is the question then?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-19T19:40:28.463", "Id": "512366", "Score": "2", ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T16:21:42.597", "Id": "259696", "Score": "0", "Tags": [ "python-3.x", "machine-learning" ], "Title": "Stacking Classifier Implementation" }
259696
<p>I have tried to achieve the following task using Factory Pattern with php-7.0.</p> <blockquote> <p>Define the classes and their methods (including parameters and return types) for a system that consist of a bookshelf, books, magazines, and notebooks. The bookshelf should allow store and retrieval of the items as wel...
[]
[ { "body": "<p>Is that really how a bookshelf work?</p>\n<blockquote>\n<p>&quot;Hello Magic Bookshelf, report status!&quot;</p>\n<p>&quot;Bookshelf contain 0 items, remaining capacity is 3&quot;</p>\n<p>&quot;Ok, spawn a new item!&quot;</p>\n<p>&quot;0&quot;</p>\n<p>&quot;Ok give me item 0!&quot;</p>\n<p>&quot;H...
{ "AcceptedAnswerId": "259712", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T16:54:44.977", "Id": "259697", "Score": "6", "Tags": [ "php", "object-oriented", "array", "design-patterns", "php7" ], "Title": "Usage of Factory pattern for maintaing...
259697
<p>I'm really new to both Python, data analysis and Panda and for gathering a bit of familiarity with this components and trying to replicate a trading strategy I'm creating a function that give me the Wiliam Fractal technical indicator, which by nature is a lagging indicator to apply at the currently analysed row of t...
[]
[ { "body": "<p>Looks good, just a few ideas:</p>\n<ol>\n<li><p>Since the function only returns two Series, you can save some overhead by removing the <a href=\"https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.copy.html\" rel=\"nofollow noreferrer\"><code>copy()</code></a> and just working with Serie...
{ "AcceptedAnswerId": "259718", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T20:37:51.627", "Id": "259703", "Score": "1", "Tags": [ "python", "beginner", "pandas" ], "Title": "William Fractal technical indicator implementation" }
259703
<p>I'm relatively new when it comes to programming in React and in JavaScript, but have a surface level understanding of what things do. I've created a basic program that fetches user data from an API that generates random users, and appends the users to a list when you click a button. I was wondering if what I'm writi...
[]
[ { "body": "<p>my two cents.</p>\n<blockquote>\n<p>if what I'm writing is good enough to be considered for a Jr. React Dev position</p>\n</blockquote>\n<p>This answer is completely subjective and depends on the company you're applying to. Each company has different expectations.</p>\n<p>That being said, here are...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T22:16:19.223", "Id": "259705", "Score": "1", "Tags": [ "beginner", "react.js", "jsx" ], "Title": "Created a basic User Profile List using an API (React)" }
259705
<p>My first project in C/SDL2 after completing a short tutorial coding Pong. These 2 projects are my entire experience with both C and SDL2, although I had some previous basic experience with Python.</p> <p>I also added a &quot;life trail&quot; that shows recently deceased cells in grey. Darker grey = died more recentl...
[]
[ { "body": "<ul>\n<li><p>We don't need to store the <code>x</code> and <code>y</code> coords in the <code>Cell</code> itself. We can calculate them cheaply when iterating through the grid.</p>\n</li>\n<li><p>We don't need to store the previous game grid. When doing the update in <code>TimeStep</code> we can set ...
{ "AcceptedAnswerId": "259724", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-04-18T22:18:09.297", "Id": "259706", "Score": "2", "Tags": [ "beginner", "c", "game-of-life", "sdl2" ], "Title": "Game of Life in C/SDL2" }
259706