body stringlengths 25 86.7k | comments list | answers list | meta_data dict | question_id stringlengths 1 6 |
|---|---|---|---|---|
<p><a href="https://github.com/puneet222/MyMoney" rel="nofollow noreferrer">Github repo</a></p>
<p>I've attempted a backend assignment in Go from geektrust <a href="https://www.geektrust.in/coding-problem/backend/mymoney" rel="nofollow noreferrer">Assignment Link</a>.
I'm not sure the code that I have written is idioma... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-07-06T06:47:56.000",
"Id": "520868",
"Score": "1",
"body": "The current question title, which states your concerns about the code, applies to too many questions on this site to be useful. The site standard is for the title to **simply sta... | [
{
"body": "<p>I suggest avoid running the commands/build code if you received an error when reading the file. In the case of an error, I would prefer to not let the program continue. Below I used the <code>else</code> block, but you could also use <code>os.Exit(0)</code> to quit after an error (just beware that... | {
"AcceptedAnswerId": null,
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T11:05:44.860",
"Id": "263102",
"Score": "-1",
"Tags": [
"go"
],
"Title": "How to make this code's design better?"
} | 263102 |
<p>I needed some help with Flex. I am trying to achieve something like <a href="https://imgur.com/wpZ2P9F" rel="nofollow noreferrer">this</a> using flex but I cant seem to align all the items to the left for both. The code I provided below works just fine, but I'm sure there has to be a better way to do it but nothing ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T15:54:10.440",
"Id": "519412",
"Score": "0",
"body": "Welcome to Code Review! The description is confusing because it states \"_but I cant seem to align all the items to the left for both._\" then goes on to state: \"_The code I pro... | [
{
"body": "<p>I played a little with css and ended up with this. I don't know if it's really what you wanted, but maybe it can help you get some new ideas.</p>\n<p><div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\r\n<div class=\"snippet-code\">\r\n<pre clas... | {
"AcceptedAnswerId": "263124",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T13:29:00.600",
"Id": "263105",
"Score": "2",
"Tags": [
"html",
"css"
],
"Title": "Using CSS, surely there is a better way to write this Flex code?"
} | 263105 |
<p>I am creating my first business application. Unfortunately, I do not have anyone experienced in .NET or c# to review my code, and this is my first time not only using SQL, but also creating code in a professional environment. As such, I would appreciate some form of criticism / review of my User class which, so far,... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T06:31:15.747",
"Id": "519452",
"Score": "2",
"body": "1. Use [Dapper](https://dapper-tutorial.net/). 2. [Properly handle IDisposable objects](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/using-objects)."
},
... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "9",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T14:48:15.460",
"Id": "263110",
"Score": "1",
"Tags": [
"c#",
"object-oriented",
".net"
],
"Title": "C# User class using SqlServer Database"
} | 263110 |
<p>I am trying to translate book: Game Physics Engine Development by Ian Millington to DirectXMath and faced with the code wich transform inertia tensor. Is it right to convert code from book like that:
from book:</p>
<pre><code>static inline void _transformInertiaTensor(glm::mat3 &iitWorld, const glm::quat &q,... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T16:19:25.050",
"Id": "519414",
"Score": "0",
"body": "Have you tested your code? Does it appear to work?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T18:55:43.540",
"Id": "519424",
"Score":... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T15:49:59.903",
"Id": "263111",
"Score": "0",
"Tags": [
"c++",
"matrix",
"mathematics",
"physics"
],
"Title": "Transform inertia tensor"
} | 263111 |
<p>I have the following implementation for the <code>__lt__</code>. Could you please check if it's okay to compare objects like that?</p>
<pre><code>class Record(NamedTuple):
video_id: str
uuid: Optional[UUID]
mac: Optional[str]
s3_bucket: str
s3_key: str
reference_date: date
@staticmethod
... | [] | [
{
"body": "<p>This code is dangerous:</p>\n<pre class=\"lang-py prettyprint-override\"><code> if a and b:\n return a < b\n if a is None and b:\n return True\n return False\n</code></pre>\n<p>Consider <code>a = -1</code> and <code>b = 0</code>. <code>a and b</code> ... | {
"AcceptedAnswerId": "263132",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T15:53:44.697",
"Id": "263112",
"Score": "7",
"Tags": [
"python",
"python-3.x"
],
"Title": "Named tuple with less-than operator"
} | 263112 |
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/263071/231235">Two dimensional bicubic interpolation implementation in Matlab</a>. While I am working on neural network designing, I want to compare the effects between using padding and using linear / non-linear interpolation on severa... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T16:47:23.423",
"Id": "263113",
"Score": "0",
"Tags": [
"performance",
"algorithm",
"image",
"numerical-methods",
"matlab"
],
"Title": "Two dimensional bicubic interpolatio... | 263113 |
<p>I am creating a command in my discord bot to send an announcement to every server it is in, and this is the only way i could think of doing it, but i know there is a more efficient way of doing it.</p>
<p>Can anyone help me in improving this code, as it stand ATM it works 100% (well i have testing in a local control... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T17:37:56.197",
"Id": "263115",
"Score": "1",
"Tags": [
"javascript",
"performance",
"discord"
],
"Title": "More Efficent Code for Announcment Command in Discord.js"
} | 263115 |
<p>I've only just started learning javascript and decided to try and make a simple app where individual countries can be selected, highlighting them, and the name appearing in the top corner.</p>
<p>The code works, but there as a novice I'm sure its far from the best way to do it! One thing I feel isn't the best is usi... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T17:41:56.803",
"Id": "263116",
"Score": "2",
"Tags": [
"css",
"react.js",
"jsx",
"user-interface",
"leaflet"
],
"Title": "Create a map where countries can be selected usin... | 263116 |
<p>I am trying to implement a small programming language, in Nim, as a way of improving my (close to non-existent) programming skills. The programming language is intended to have IF-GOTO, variables, and the ability to read from stdin. First, I wrote the VM, this thing:</p>
<pre><code>import strutils
#Nim module for st... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T09:35:06.560",
"Id": "519567",
"Score": "0",
"body": "Is this the right version of the code? I'm just getting `Error: undeclared identifier: 'branched'` when trying to run the first snippet."
},
{
"ContentLicense": "CC BY-SA... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T20:00:51.513",
"Id": "263120",
"Score": "2",
"Tags": [
"performance",
"beginner",
"interpreter",
"virtual-machine",
"nim"
],
"Title": "Small language, compiles to register... | 263120 |
<p>I have the following class</p>
<pre><code>class Dob:
def __init__(self):
self.welcome_text = ""
#Computes DOB
def calc_dob(self):
pass
#Get User Input
def get_input(self, msg):
pass
def __repr__(self):
print(self.welcome_text)
total_day... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T21:33:19.173",
"Id": "519430",
"Score": "0",
"body": "The reason why pycharm \"complains\" is because `self` is not used in the methods `calc_dob` or `get_input`. Once you fill out these functions it will be Ok! I would also recomme... | [
{
"body": "<p>The design of the above class is wrong and I can see now. A <strong>birthday</strong> Object should hold date and relevant data as Instance Variables, and it shouldn't be responsible for printing to the console.</p>\n<p>I/O should be done when calling the class. And as we have a Date Object alread... | {
"AcceptedAnswerId": "263137",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T20:26:47.780",
"Id": "263121",
"Score": "-1",
"Tags": [
"python-3.x",
"object-oriented",
"design-patterns"
],
"Title": "Proper way to Implement a Birthday Class in Object Orie... | 263121 |
<p>I'm struggling to solve this Kata. My code works but I can't pass because it's timing out. I have googled it and even tried other people's code but still doesn't pass.</p>
<p>Any suggestion on how can I make a faster solution?</p>
<p><strong>The Kata:</strong>
<a href="https://www.codewars.com/kata/54eb33e5bc1a25440... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T01:18:38.920",
"Id": "519436",
"Score": "0",
"body": "I doubt it works. Better try **stackoverflow.com**. For every count you have to add either `(n - count)` or skip it. In the first case you could recursively call to see whether t... | [
{
"body": "<p>Just have a java at hand.</p>\n<p>Your function:</p>\n<pre><code>List<Integer> decompose(int n) {\n int count = 1;\n List<Integer> lst = new ArrayList<>();\n int tot = n * n;\n while (tot > 0) {\n if (n - count == 0) {\n return Collections.emptyLi... | {
"AcceptedAnswerId": null,
"CommentCount": "5",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-16T23:49:36.793",
"Id": "263125",
"Score": "2",
"Tags": [
"python",
"performance",
"programming-challenge",
"time-limit-exceeded"
],
"Title": "return the sum of the squares that ... | 263125 |
<p>I got lot of suggestions for optimizing my neural network last post I made, now I wanted to post updated version of it were I got rid of most of performance eaters, now I would really appriciate <strong>neural network side help</strong>, because last post I only got c++ side stuff, program is working as excpected, b... | [] | [
{
"body": "<h1>Write only one statement per line</h1>\n<p>For some reason you decided to make all the activation functions and their derivatives one-liners. This results in some very long lines, requiring sideways scrolling. I recommend you just use one statement per line.</p>\n<h1>Make constants <code>static c... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T00:42:38.193",
"Id": "263126",
"Score": "2",
"Tags": [
"c++",
"performance",
"machine-learning",
"neural-network"
],
"Title": "Updated version of my first neural network in c+... | 263126 |
<p>The <a href="https://i.stack.imgur.com/ElBNM.png" rel="nofollow noreferrer">exercise</a> is asking to make wider stripes similar to the previous exercise. I've included the exercise and code from it along with code that I've been messing with to get the desired result.</p>
<p>I know it can be done easily with loops,... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T12:04:44.823",
"Id": "519574",
"Score": "0",
"body": "`total-rows` is invalid since `HEIGHT` isn't defined anywhere. Also `always-zero` is missing in this snippet, making it not runnable. If you wanna be nice to readers consider add... | [
{
"body": "<p>To answer that first, you don't need anything complicated, just observe\nthat the pattern is binary, on and off, and compare that with\nhow odd and even numbers are following the same pattern, then apply that\nand scale by the strip width.</p>\n<p>Once you see that, you can define it in multiple w... | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T01:37:11.227",
"Id": "263127",
"Score": "3",
"Tags": [
"racket"
],
"Title": "Wide-stripes function in Racket"
} | 263127 |
<p>I'm don't know much about javascript, but and slowly learning through using other people's code. The below code I'm using is quite repetitive, with the only variance being the ID names. I feel like someone will know (and hopefully show) me how to do this show/hide function better.</p>
<pre><code>$('#C7-Drawer-Shelf-... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T14:42:40.467",
"Id": "519508",
"Score": "1",
"body": "Are you sure this is correct? It seems strange that all event handlers would toggle the same element(s). Can you add the HTML that belongs to this?"
},
{
"ContentLicense"... | [
{
"body": "<p>You can change the selector to select all items at once.</p>\n<p>First option: select all ids comma separated:</p>\n<pre><code>$('#C7-Drawer-Shelf-Combo,#T7-Drawer-Shelf-Combo,#C11-Drawer-Shelf-Combo').on('change', function () {\n if (this.value) {\n $(".under-drawer-bench").show();\... | {
"AcceptedAnswerId": "263134",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T01:46:21.090",
"Id": "263128",
"Score": "3",
"Tags": [
"javascript",
"beginner",
"jquery"
],
"Title": "Show/hide for multiple IDs"
} | 263128 |
<p>I manage a fleet of IoT devices.</p>
<p>As for now, GitHub announced that the username-password authentication would be deprecative soon, so I have to change the password on each device to the GitHub access token.
I store the new token at AWS secrets manager. And those are the scripts to extract the new token and im... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T07:46:34.637",
"Id": "263136",
"Score": "1",
"Tags": [
"python",
"python-3.x",
"programming-challenge"
],
"Title": "Python script to replace GitHub password with tokens"
} | 263136 |
<p>I made a small adaptive function that sorts vector:</p>
<pre class="lang-cpp prettyprint-override"><code>template<class T>
vector<T> BubbleSort(vector<T> arr, bool (*compare)(T, T)) {
const int arraySize = arr.size(); //Size of vector. Is it ok to leave it const?
//int i = 1 - to be able to... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T13:22:47.350",
"Id": "519495",
"Score": "2",
"body": "This is some strange variation of bubble sort, if it is bubble sort at al. Bubble sort is when the biggest element \"floats\" to the top, then the second \"floats\" under it and ... | [
{
"body": "<p>You understand that making the code faster means reducing the value of k1 in the complexity of <code>k1*n²</code> while using a different algorithm would change that to <code>k2*n*log(n)</code>. But understanding that...</p>\n<p><code>template<class T> vector<T> BubbleSort(vector<T... | {
"AcceptedAnswerId": "263147",
"CommentCount": "7",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T11:37:20.500",
"Id": "263140",
"Score": "1",
"Tags": [
"c++",
"performance",
"sorting",
"vectors"
],
"Title": "C++ vector bubble sort in my edition"
} | 263140 |
<p>I started reading a book about python two days ago and today I wrote my first code. It's supposed to be a rock, paper, scissors game and from the tests I've done so far it works quite well.</p>
<p>However since I'm new I had to google a lot stuff and I'm 100% sure that there are a lot of things I could have done bet... | [] | [
{
"body": "<p><strong>Organize code in commented paragraphs or small sections</strong>. It's good that you\nare being methodical in your approach and that you have embraced code comments.\nHowever, every good thing can be taken to unhelpful extremes. A\ncomment-per-line or a comment-per-step is probably too muc... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T15:17:21.553",
"Id": "263150",
"Score": "4",
"Tags": [
"python",
"beginner",
"rock-paper-scissors"
],
"Title": "Rock, paper and scissors"
} | 263150 |
<p>As part of my testing, I have to connect to Unix server using putty and execute few unix jobs.</p>
<p>Feature file
Steps for test scenario:</p>
<pre><code>Scenario Outline: Job execution in Unix
Given I logged into unix server
When I navigate to job directory "<job_directory_path>" and submit the job... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T12:59:41.897",
"Id": "519865",
"Score": "1",
"body": "Methods initialise variables called \"ucon\" then attempt method calls on \"uc\". If the OP won't present compiled and tested code, why should we review it?"
},
{
"Conten... | [
{
"body": "<blockquote>\n<p>Is my implementation approch correct?</p>\n</blockquote>\n<p>You mean, your implementation of <code>Unixcon.JAVA</code> ? Then if it works as expected it may be correct but I doubt because there are some typos and invalid syntax in your code:</p>\n<h2>Strange errors</h2>\n<p><em>(tha... | {
"AcceptedAnswerId": null,
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T15:40:15.203",
"Id": "263152",
"Score": "0",
"Tags": [
"java",
"selenium",
"unix",
"automation",
"cucumber"
],
"Title": "Unix batch job execution from BDD automation frame... | 263152 |
<p>I have some performance critical inter-thread messaging code in C++. Multiple producers, one or more consumers.</p>
<p>Profiling dozens of iterations of this messaging code over several years of development, I'm usually fighting mutex contention. If not a direct mutex on a std::queue, then a heap mutex on the data p... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T21:29:13.640",
"Id": "519540",
"Score": "0",
"body": "Is this possible: Thread 0: TryConsume => load toRead/toWrite => check empty (not empty) => context switch (right before state compare exchange). In the meantime Thread 1: TryCon... | [
{
"body": "<blockquote>\n<pre><code> template<class T, uint8_t BitsForItemCount> class RingBuffer\n</code></pre>\n</blockquote>\n<p>This is missing</p>\n<pre><code>#include <cstdint>\nusing std::uint8_t\n</code></pre>\n<p>That said, I really dislike headers that populate the global namespace, so I ... | {
"AcceptedAnswerId": null,
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T17:10:07.410",
"Id": "263157",
"Score": "20",
"Tags": [
"c++",
"multithreading",
"c++20",
"lock-free",
"atomic"
],
"Title": "C++ lock-free, MPMC Ring buffer in C++20"
} | 263157 |
<p>This is a challenge I completed at CodeSignal.</p>
<p>You are given an array of desired filenames in the order of their creation. Since two files cannot have equal names, the one which comes later will have an addition to its name in a form of <code>(k)</code>, where <code>k</code> is the smallest positive integer s... | [] | [
{
"body": "<p>Seems to be some edge cases to take care of here, so good job on that :)</p>\n<ul>\n<li>You could use a Set instead of an array since you're doing lots of checking the whole array for if an item exists. It would also hammer in the fact that the result should be a unique list of names</li>\n<li>Fir... | {
"AcceptedAnswerId": "263160",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T18:04:26.223",
"Id": "263159",
"Score": "4",
"Tags": [
"javascript",
"array",
"ecmascript-6"
],
"Title": "File naming (two files cannot have equal names)"
} | 263159 |
<p>I have two arrays, <code>arr_of_frequencies</code> and <code>float_array</code>, of the same length — around 500-800k values each. I have to get that down to somewhere between 200 and 300k values per array. Below is the code I've been using so far. It works but it will take around 15 seconds to run, which is about 1... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T00:01:39.253",
"Id": "519650",
"Score": "0",
"body": "is this a pro-audio app?"
}
] | [
{
"body": "<p>I would avoid splicing an array. If I remember correctly, changing the size of an array has implications under the hood. It's probably better if you created a new array of new values, if you have memory to spare.</p>\n<p>You can create a custom function that asynchronously iterates and operates th... | {
"AcceptedAnswerId": "263185",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T20:18:23.510",
"Id": "263162",
"Score": "2",
"Tags": [
"javascript",
"array",
"time-limit-exceeded"
],
"Title": "Keeping only every nth element in an array in JavaScript"
} | 263162 |
<p>This python program analyzes movie data by finding the average budget of films in a data set - it also identifies films that exceed the average budget calculated.</p>
<p>I need advice on my code in terms of (architecture, risks, opportunities, design) so that I can learn how I can code better & grow my skills.</... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T09:25:34.547",
"Id": "519566",
"Score": "2",
"body": "This is entirely irrelevant to your specific question, but in terms of data analysis, [Hollywood accounting](https://en.wikipedia.org/wiki/Hollywood_accounting) is a good example... | [
{
"body": "<p><strong>Data entry without persistence does not make sense in most contexts</strong>. If a\nhuman has to type the data, save it somewhere. It could be a JSON file, CSV\nfile, database, whatever you would like to try. This kind of approach -- where\nthe data lives separately from the code -- has ma... | {
"AcceptedAnswerId": null,
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T21:02:37.470",
"Id": "263164",
"Score": "6",
"Tags": [
"python",
"python-3.x"
],
"Title": "Analyzing average movie budgets using Python 3"
} | 263164 |
<p>To give a short contextual description: It is a poker game. I plan to add "cards" and a "pot"-object later on and then learn event-driven programming so that I can add a GUI. Essentially the player's placement in the game-objects "player" variable determines their seat.</p>
<p>My main q... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T20:14:34.530",
"Id": "519638",
"Score": "1",
"body": "The first program that I ever tried to write was an OO poker game. I remember gatting stuck trying to implement a truly random shuffle() method. There were plenty online, but I w... | [
{
"body": "<p>Welcome to CodeExchange. Here are some ways in which your code can be improved:</p>\n<h1>Code Style</h1>\n<h2>Naming conventions</h2>\n<p>Please, use <a href=\"https://www.python.org/dev/peps/pep-0008/\" rel=\"nofollow noreferrer\">PEP-8</a> naming conventions. For example, all classes names have ... | {
"AcceptedAnswerId": "263198",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-17T21:55:58.887",
"Id": "263166",
"Score": "2",
"Tags": [
"python",
"game"
],
"Title": "Object-oriented poker game"
} | 263166 |
<p>I made a FizzBuzz program in arm64; I print out the values in hex instead of decimal. This was the first arm64 program I made and I'm looking for advice on how I can improve it.</p>
<p>The code to print out the registers was taken from the textbook: <em>Programming with 64-Bit ARM Assembly Language: Single Board Com... | [] | [
{
"body": "<p>Using trial division with <code>udiv</code> isn't the best algorithm for FizzBuzz. It's easier to maintain a pair of counters; one counts up to 3 and resets, and the other to 5. We can combine this into a single counter (up to 15) if we like.</p>\n<p>The range is very limited - when we reach 255... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T00:27:28.287",
"Id": "263170",
"Score": "2",
"Tags": [
"beginner",
"assembly",
"fizzbuzz",
"arm"
],
"Title": "FizzBuzz in arm64"
} | 263170 |
<p>In this python program, I built a ticketing system with functionality such as keeping track of tickets sold and error handling in case there are any invalid inputs.</p>
<p>I need advice on my code in terms of (architecture, risks, opportunities, design) so that I can learn how I can code better & grow my skills.... | [] | [
{
"body": "<ol>\n<li><p>Overall, your code looks pretty clean and well explained;</p>\n</li>\n<li><p>When you want to get a 'yes' or 'no' from the user I advise you to just check the character you need the user to type so that you disregard typos or excesses. So instead of <code>if proceed.lower() == 'yes'</cod... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T00:43:18.017",
"Id": "263171",
"Score": "3",
"Tags": [
"python",
"python-3.x"
],
"Title": "Ticketing program using Python 3"
} | 263171 |
<p>I'm getting the highest value and its respective from a dictionary and printing it out for the user.</p>
<p>Even though it's working, I'm wondering if I'm doing it in the cleanest way. Here it is:</p>
<pre class="lang-py prettyprint-override"><code>People = {'Harry': 20, 'Ron': 19, 'Hermione': 21, 'Hagrid': 54}
pri... | [] | [
{
"body": "<blockquote>\n<p>What would you do differently from this?</p>\n</blockquote>\n<ul>\n<li><p><a href=\"https://www.python.org/dev/peps/pep-0008/#function-and-variable-names\" rel=\"noreferrer\">PEP 8</a>: Variable names should be lowercase. <code>People</code> -> <code>people</code>.</p>\n</li>\n<li... | {
"AcceptedAnswerId": "263177",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T01:07:14.113",
"Id": "263172",
"Score": "9",
"Tags": [
"python",
"hash-map"
],
"Title": "The cleanest way to print the max value and its key from a dictionary"
} | 263172 |
<p>I'm new in React and state hooks.I'm trying to make a website about creating booklist and save it to local storage. Also uploading image to cloudinary. My problem is ; when i trying to save cloudinary image url to the localstorage, it saves previous url. I think i have a problem about useState,useEffect hooks but i ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T14:18:24.837",
"Id": "519681",
"Score": "1",
"body": "When you need help debugging a problem please use [stackoverflow.com](https://stackoverflow.com/help/how-to-ask). Code Review is for code that is working as expected. We help you... | [
{
"body": "<p>State won't be updated immediately after a state setter function call. Actually when you call a state setter function you tell React to update a state value and schedule a re-render. It means you get that value next time the component renders. The better explanation of how it works is available in... | {
"AcceptedAnswerId": "263209",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T03:07:59.277",
"Id": "263174",
"Score": "0",
"Tags": [
"javascript",
"react.js"
],
"Title": "React useState,useEffect - save variables to local storage"
} | 263174 |
<p>In this python program, I used lists and control flow to allow users to add items to a shopping list and display the list.</p>
<p>I need advice on my code in terms of (architecture, risks, opportunities, design) so that I can learn how I can code better & grow my skills.</p>
<pre><code>shopping_list = []
# Add ... | [] | [
{
"body": "<hr />\n<p><a href=\"http://%20https://blog.codinghorror.com/code-tells-you-how-comments-tell-you-why/\" rel=\"nofollow noreferrer\"><strong><code>Code Tells You How, Comments Tell You Why?</code></strong></a></p>\n<p>You have tried to document your code through comments, which is great! However, com... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T03:13:10.597",
"Id": "263175",
"Score": "1",
"Tags": [
"python",
"python-3.x"
],
"Title": "Shopping list using Python 3"
} | 263175 |
<p>I'm looking for feedback on my solution to the following prompt:</p>
<blockquote>
<p>Given an array of ints, return the index such that the sum of the
elements to the right of that index equals the sum of the elements
to the left of that index. If there is no such index, return Nothing.
If there is more than one suc... | [] | [
{
"body": "<ol>\n<li>You can use scans to implement this:</li>\n</ol>\n<pre class=\"lang-hs prettyprint-override\"><code>import Data.List\n\npeak :: [Int] -> Maybe Int\npeak [] = Nothing\npeak xs = elemIndex True $ zipWith (==) (scanl1 (+) xs) (scanr1 (+) xs)\n</code></pre>\n<ol start=\"2\">\n<li>I don't thi... | {
"AcceptedAnswerId": "263181",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T03:15:37.540",
"Id": "263176",
"Score": "1",
"Tags": [
"beginner",
"haskell",
"recursion"
],
"Title": "Equivalent partition sums"
} | 263176 |
<p>In <a href="https://codereview.stackexchange.com/q/258757/87743">my previous question</a>, one of the answers mentioned that I shouldn't be changing behavior based on the Event class</p>
<blockquote>
<p>The whole point of classing is that you can get result without having to decide based on instance.</p>
</blockquot... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T07:10:24.450",
"Id": "263178",
"Score": "3",
"Tags": [
"kotlin",
"type-safety",
"immutability",
"visitor-pattern"
],
"Title": "Replacing type-check with Visitor in Immutable E... | 263178 |
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/263071/231235">Two dimensional bicubic interpolation implementation in Matlab</a> and <a href="https://codereview.stackexchange.com/q/263024/231235">Two dimensional gaussian image generator in C</a>. Besides the Matlab version code, I a... | [] | [
{
"body": "<h1>Avoid unnecesary allocation of temporary storage</h1>\n<p>In the innermost loop, you do this:</p>\n<pre><code>unsigned char* ndata;\nndata = malloc(sizeof *ndata * 4 * 4);\n</code></pre>\n<p>This is slow and completely unnecessary; you can just declare an array on the stack like so:</p>\n<pre><co... | {
"AcceptedAnswerId": "263201",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T10:18:38.400",
"Id": "263183",
"Score": "4",
"Tags": [
"algorithm",
"c",
"reinventing-the-wheel",
"image",
"numerical-methods"
],
"Title": "Two dimensional bicubic int... | 263183 |
<p>I have this code, which counts only adjacent letters in a string and returns the count of each letter.</p>
<pre><code>const inputData = [
'aabbc',
'xxxxvvhjh',
'PPPOM'
];
let output = [];
inputData.forEach(str => {
let strObj = {};
for (let i = 0; i < str.length; i++) {
if (strObj[str[i]] &&a... | [] | [
{
"body": "<p>I am not familiar with javascript, but seems like you are iterating over inputs twice, you really just need to iterate over it once. here is how(I might write a pseudo code later)\n<strong>at start:</strong></p>\n<ol>\n<li><p>create variable(char) <code>lastCharacter</code> and (int)<code>characte... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T14:10:23.520",
"Id": "263188",
"Score": "1",
"Tags": [
"javascript",
"strings",
"ecmascript-6",
"compression"
],
"Title": "Run-length coder"
} | 263188 |
<p>I've written a small rust library that solves rust's problems with using recursive data types (e.g, linked lists).</p>
<p>using the library, you can use <code>RecRef<'_, List></code>, and use it to travel up and down your list dynamically and safely at will.</p>
<p>It uses unsafe primitives but uses a clever t... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T16:19:51.643",
"Id": "263194",
"Score": "4",
"Tags": [
"rust",
"library"
],
"Title": "Small generic helper library for working with recursive data structures"
} | 263194 |
<p>I am not very experienced with T-SQL and feel this can be done better. The script changes ownership of all "user" (non-system) databases to <code>sa</code>.</p>
<p>Usage of a dynamic SQL expression seems unavoidable to me. Could I at least iterate the table names in a more elegant way — imperative code loo... | [] | [
{
"body": "<p>You could use <a href=\"https://docs.microsoft.com/en-us/sql/relational-databases/system-information-schema-views/system-information-schema-views-transact-sql?view=sql-server-ver15\" rel=\"nofollow noreferrer\">INFORMATION_SCHEMA.TABLES</a> instead (note that INFORMATION_SCHEMA is found in other A... | {
"AcceptedAnswerId": "263200",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-18T17:16:19.957",
"Id": "263196",
"Score": "3",
"Tags": [
"sql",
"sql-server",
"t-sql"
],
"Title": "Alter authorization on all non-system SQL Server databases"
} | 263196 |
<p>I want to optimize my code for following question:</p>
<blockquote>
<p>A company sells dumbbells in pairs. These are weights for exercising. They receive a shipment of dumbbells weighing anywhere from 1 unit up to a certain maximum.</p>
<p>A pair can only be sold if their weights are sufficiently close: no greater t... | [] | [
{
"body": "<p>The task doesn't require to generate a list of pairs - just to count them. So:</p>\n<ul>\n<li>take as much 1-1 pairs as you can ('count += arr[0]//2');</li>\n<li>if one dumbbell is left ('arr[0]' is odd) and there are dumbbells of weight 2, increase count and reduce 'arr<a href=\"https://www.pytho... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T10:23:44.490",
"Id": "263213",
"Score": "6",
"Tags": [
"python"
],
"Title": "Count the number of saleable pairs of items"
} | 263213 |
<p>This is how I handle configuration in my python code, currently, but I guess it might look magic to people, and it is cumbersome to code. How can this be improved? Are there better solutions?</p>
<p>The purpose is to have a general working configuration stored in UPPER CASE in global variables at the beginning of th... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T12:12:35.143",
"Id": "519672",
"Score": "1",
"body": "Can you include an example JSON file?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T12:45:03.167",
"Id": "519673",
"Score": "0",
"bo... | [
{
"body": "<p><code>read_config</code> does not do what's on the tin: it attempts to read the config, conditionally writes out a default config, and sets globals. Those obligations should be separated.</p>\n<p>Also, your <code>example</code> is a mystery: is it a section? Currently it offers no value and a flat... | {
"AcceptedAnswerId": null,
"CommentCount": "9",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T11:12:14.927",
"Id": "263215",
"Score": "3",
"Tags": [
"python",
"json",
"configuration"
],
"Title": "How to handle configuration from a config file and global variables transpare... | 263215 |
<p>phoneNumberCheck() is using 2 helper function to check if a users input of a phone number is valid.</p>
<ol>
<li><p>this is a client side check, if this code is ok should I check the same at the nodeJS back end?</p>
</li>
<li><p>is splitting the number validation function to validate length and another function to v... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T16:23:24.617",
"Id": "519687",
"Score": "0",
"body": "This doesn't seem to make sense to me. What exactly are valid inputs?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T17:58:41.127",
"Id": "51... | [
{
"body": "<blockquote>\n<p>this is a client side check, if this code is ok should I check the same at the nodeJS back end?</p>\n</blockquote>\n<p>Yes! The server has no idea what's <em>really</em> running on the other side of the connection - all it knows is what data it gets. Maybe it's talking to an old vers... | {
"AcceptedAnswerId": "263222",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T14:50:27.803",
"Id": "263217",
"Score": "3",
"Tags": [
"javascript",
"node.js",
"validation"
],
"Title": "Sanitation and validation of a user input 10 digits phone number"
} | 263217 |
<p>This is my first asyncio/aiohttp web scraper. I am trying to wrap my head around Python's asyncio/aiohttp libs these days and I am not sure if I fully understand it or not yet. So I'd like have some constructive enhancement reviews here.</p>
<p>I'm scraping <a href="https://www.spoonflower.com/" rel="nofollow norefe... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T18:48:16.083",
"Id": "519693",
"Score": "0",
"body": "Is there public documentation available for the site's API? If there is, could you add a link to it?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-... | [
{
"body": "<p>I'm not too experienced with asyncio, but I have a couple of minor observations about your program.</p>\n<p>It is a code smell in modern Python to use an int to index over an array. Instead of</p>\n<pre><code>for index in range(len(fabric)):\n</code></pre>\n<p>You could say</p>\n<pre><code>for fa... | {
"AcceptedAnswerId": null,
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T17:02:57.973",
"Id": "263221",
"Score": "11",
"Tags": [
"python",
"python-3.x",
"web-scraping",
"async-await"
],
"Title": "Asynchronously scrape fabric information"
} | 263221 |
<p>Loader - load commands files(classes) from directory of commands and module, if the commands are very simple and similar, then I put them in 1 file with the name of the module and load them through the loop in the same way as usual commands</p>
<pre><code> public async load_Commands():Promise<void> {
... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T21:01:30.897",
"Id": "519699",
"Score": "2",
"body": "It's difficult to review code without knowing what it does and why. Could you please add a description of what your code is intended to do?"
},
{
"ContentLicense": "CC BY... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-19T19:35:04.340",
"Id": "263225",
"Score": "0",
"Tags": [
"node.js",
"typescript",
"dynamic-loading"
],
"Title": "Commands loader"
} | 263225 |
<p>I would like to return or save for later use in the ParallelSums function what I currently have printing out to the console in the findAllSubsetsRec function.</p>
<p>If I pass the ParallelSums function an int array of [16, 22, 35, 8, 20, 1, 21, 11] I currently get the console output from the findAllSubsetsRec of:</p... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T08:28:25.117",
"Id": "519714",
"Score": "2",
"body": "Only working as intended code is suitable for Code Review. You may ask the question on [StackOverflow](https://stackoverflow.com/) instead."
},
{
"ContentLicense": "CC BY... | [
{
"body": "<p>I added a <code>private static Dictionary<int, List<List<int>>> _dictionary = new Dictionary<int, List<List<int>>>();</code> so that I can access the dictionary at any level of the recursion and then enter values like this:</p>\n<pre><code>if (!_dictionary.Conta... | {
"AcceptedAnswerId": "263234",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T00:39:09.507",
"Id": "263229",
"Score": "0",
"Tags": [
"c#",
"recursion"
],
"Title": "Return Lists from Recursive Function C#"
} | 263229 |
<p>For an integer array <code>nums</code>, an inverse pair is a pair of integers <code>[i, j]</code> where <code>0 <= i < j < nums.length</code> and <code>nums[i] > nums[j]</code>.</p>
<p>Given two integers n and k, return the number of different arrays consisting of numbers from 1 to n such that there are ... | [] | [
{
"body": "<p><strong>The memoization is not helping</strong>. In fact, it's slowing things down\nconsiderably. I executed your code for all pairs of <code>n</code> and <code>k</code> from <code>0</code>\nthrough <code>9</code>, inclusive: it took 16 seconds on my computer. Then I commented out the memoization\... | {
"AcceptedAnswerId": "263301",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T00:44:21.497",
"Id": "263230",
"Score": "5",
"Tags": [
"python",
"dynamic-programming"
],
"Title": "K Inverse Pairs Array - Brute Force"
} | 263230 |
<p>I'm using <code>ManagementEventWatcher</code> to monitoring some process. It works well but I think the code's kinda repetitive. I was wondering what would be the correct way for more than once single process, if I had more than two process it'd become a mess. Thanks!</p>
<pre><code>private async void Form1_Load(obj... | [] | [
{
"body": "<pre class=\"lang-cs prettyprint-override\"><code>private async void Form1_Load\n</code></pre>\n<p>Why <code>async</code> without <code>await</code>? Remove <code>async</code>.</p>\n<p>The query can be a constant like</p>\n<pre class=\"lang-cs prettyprint-override\"><code>const string queryPattern = ... | {
"AcceptedAnswerId": "263247",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T01:32:46.443",
"Id": "263232",
"Score": "1",
"Tags": [
"c#"
],
"Title": "ManagementEventWatcher, process monitoring"
} | 263232 |
<p>I have various texts that are inconsistent in how paragraphs are formatted. Some texts use the <code><P> </P></code> tags to specify a paragraph, while others use two break tags (<code><br><br></code>). Sometimes the user forgets to close a <code><p></code> tag too. Also, a tag could co... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T08:44:07.653",
"Id": "519715",
"Score": "0",
"body": "If you are planning on writing the algorithm in another language, it might be better if you post your code in that language. Using python you could fairly easily solve the proble... | [
{
"body": "<p>You seem to be interested in algorithmic alternatives more than\na typical Python best-practices review. Here's one approach\nthat seems simpler to me: just one function, and no need for\nan <code>Input</code> class wrapping the input text. Like your solution,\nthis one does build up the delimiter... | {
"AcceptedAnswerId": "263254",
"CommentCount": "5",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T05:28:16.170",
"Id": "263242",
"Score": "3",
"Tags": [
"python",
"html"
],
"Title": "HTML Paragraph Identifier"
} | 263242 |
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/263024/231235">Two dimensional gaussian image generator in C</a>, <a href="https://codereview.stackexchange.com/q/263183/231235">Two dimensional bicubic interpolation implementation in C</a> and <a href="https://codereview.stackexchange... | [] | [
{
"body": "<p>There are image representations that lend themselves much better to passing around views of rectangular crops:</p>\n<pre><code>struct Image {\n void *pixels;\n enum format pixel_format;\n size_t width;\n size_t height;\n size_t stride;\n}\n</code></pre>\n<p>With <code>pixels</code> ... | {
"AcceptedAnswerId": "263248",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T09:24:22.480",
"Id": "263246",
"Score": "0",
"Tags": [
"c",
"reinventing-the-wheel",
"error-handling",
"image",
"memory-management"
],
"Title": "SubImage function impl... | 263246 |
<p>I have a test suite that queries a localhost-based server. The server process needs to be running in order for the server to work. The process may be running already for debugging work, but it might not be. If a server process is running, it's probably safe to assume it's the correct one. If we started the process, ... | [] | [
{
"body": "<p>Welcome to Code Review, Ari.</p>\n<h1>Good</h1>\n<ul>\n<li>indentation</li>\n<li>useful comments</li>\n</ul>\n<h1>Major suggestions</h1>\n<ul>\n<li>Regarding your server-process: it would be nice for it to have a proper "init" script to start it. Things have changed in systemd-land and ... | {
"AcceptedAnswerId": "263272",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T16:52:22.960",
"Id": "263251",
"Score": "3",
"Tags": [
"bash"
],
"Title": "Test harness that uses server process"
} | 263251 |
<p>I've just started learning python, mostly by some YouTube videos and other online tutorials.</p>
<p>Now I want to create a dictionary of callables (actions) asking for user input (a hotkey), but the user should also be able to pass more arguments to the actions.</p>
<p>My problem is, that my current solution doesn't... | [] | [
{
"body": "<p>If you are not trying to reinvent the wheel, what you want is to use some library that allows you to easily create a CLI. For example, <a href=\"https://pypi.org/project/click/\" rel=\"nofollow noreferrer\">click</a>.</p>\n",
"comments": [
{
"ContentLicense": "CC BY-SA 4.0",
... | {
"AcceptedAnswerId": "263261",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T17:01:13.460",
"Id": "263252",
"Score": "3",
"Tags": [
"python-3.x"
],
"Title": "Better solution to pass arguments to function in a dictionary"
} | 263252 |
<p>I've decided to rewrite the standard library list in a smaller version. This is similar to another question of mine, where my main concern is memory management. I allocate a new array each time the user wants to modify the list. I want to know if there are any memory leaks that I need to plug. I've been liberal usin... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T22:16:52.037",
"Id": "519755",
"Score": "6",
"body": "So this is not a reimplementation of `std::list` anymore, but rather of `std::vector`. By the way, what exactly do you mean with \"smaller version\"? Do you want to reduce the co... | [
{
"body": "<ol>\n<li>As mentioned, this is a re-implementation of <code>std::vector</code>, not <code>std::list</code>.</li>\n</ol>\n<hr />\n<ol start=\"2\">\n<li>The default constructor can be set as <code>default</code>.</li>\n</ol>\n<hr />\n<ol start=\"3\">\n<li><p>You're not following <a href=\"https://en.c... | {
"AcceptedAnswerId": "263262",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-20T21:44:20.287",
"Id": "263259",
"Score": "9",
"Tags": [
"c++",
"reinventing-the-wheel",
"c++20"
],
"Title": "std::list reimplementation"
} | 263259 |
<p>I was working in a class, but there are a lot of things that I'm not sure if they're a good practice or not. For example, the <code>=></code> instead of the <code>{ }</code>. When should I use it? Also, I'm not pretty sure about the keywords <code>const</code> and <code>readonly</code>. For example, <code>uriImag... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T03:54:00.723",
"Id": "519764",
"Score": "0",
"body": "`string key` need less than minute to get the key from the compiled executable file."
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T03:55:41.277"... | [
{
"body": "<blockquote>\n<p><code>=></code> instead of the <code>{ }</code></p>\n</blockquote>\n<p>This is personal preference. My preference, for example, is to generally use <code>{ }</code> because I like it more, stylistically. I will say if it's more than a line, using <code>=></code> (again, in my o... | {
"AcceptedAnswerId": "263266",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T01:54:51.327",
"Id": "263264",
"Score": "0",
"Tags": [
"c#",
"api",
"classes"
],
"Title": "Good practices for a class"
} | 263264 |
<p>Here is a coroutine generator class... Just like Python yields. It was a bit tedious to support both <code>co_yield</code> and <code>co_return</code> (should manage the cases flow out of function body and <code>co_return</code> separately) but it works. I wonder if it's okay, especially from the point of view of und... | [] | [
{
"body": "<h1>Minor compile issues</h1>\n<p>Not all <a href=\"https://en.cppreference.com/w/cpp/compiler_support\" rel=\"noreferrer\">compilers support</a> coroutines fully yet, and at least on GCC 10 your <code>generator</code> fails to compile, because:</p>\n<pre><code>gen.cc:70:16: error: the coroutine prom... | {
"AcceptedAnswerId": "263275",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T03:26:49.253",
"Id": "263265",
"Score": "5",
"Tags": [
"c++",
"c++20"
],
"Title": "C++20 Coroutine Generator"
} | 263265 |
<p>I have implemented a simple <em>NFA</em> that recognizes words in parallel. All the code is on GitHub, <a href="https://github.com/alexfertel/atl" rel="noreferrer">here</a>.</p>
<ul>
<li><p>A main <code>recognizes</code> method tells if a <code>word</code> (<code>&str</code>) is recognized by an <em>NFA</em>. In... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T06:02:07.760",
"Id": "519849",
"Score": "0",
"body": "Regarding the `Does not work :(` part: the lifetime of a temporary value in a `let` binding extends to the end of the enclosing scope, whereas temporary values in an expression s... | [
{
"body": "<p>Welcome to Rust, and welcome to Code Review.</p>\n<h1>File organization</h1>\n<p>First of all, the placement of test modules is unconventional:</p>\n<pre class=\"lang-rust prettyprint-override\"><code>#[cfg(test)]\n#[path = "./dfa.test.rs"]\nmod tests;\n</code></pre>\n<p>The common appro... | {
"AcceptedAnswerId": "263313",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T04:26:33.000",
"Id": "263267",
"Score": "5",
"Tags": [
"rust"
],
"Title": "Parallel word recognition in a Non-deterministic finite automaton in Rust"
} | 263267 |
<p>Created FilePickerComponent recently. I'm new to React/Web development. Could you please help reviewing this code -</p>
<pre><code>export const FilePickerButton: React.FunctionComponent<FilePickerButtonFCProps> = ({
position,
ariaLabel,
ariaDescription,
disabled,
iconName,
toolbarButton... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T06:03:17.823",
"Id": "263268",
"Score": "2",
"Tags": [
"react.js",
"jsx"
],
"Title": "File Picker Component - React"
} | 263268 |
<p>This is a Python script that generates ngrams using a set of rules of what letters can follow a letter stored in a dictionary.</p>
<p>The output is then preliminarily processed using another script, then it will be filtered further using an api of sorts by number of words containing the ngrams, the result will be us... | [] | [
{
"body": "<blockquote>\n<p>Any help will be appreciated</p>\n</blockquote>\n<p>A few suggestions on something that I noticed:</p>\n<ul>\n<li><p>In the function <code>makechain</code> the <code>else</code> after the <code>return</code> is not necessary.</p>\n</li>\n<li><p>Typo in: <code>VOWELS = set('aeiouy')</... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T06:58:24.067",
"Id": "263271",
"Score": "3",
"Tags": [
"python",
"performance",
"beginner",
"python-3.x"
],
"Title": "Python script that makes ngrams"
} | 263271 |
<p>This is a Python 3.9 script that pulls data from a MySQL database and converts it to a list of named tuples and then passing it to <code>PyQt6.QTreeWidget</code>.</p>
<p>It has to be a <code>list</code> of <code>namedtuples</code>, because I am going to store lists of tags packed in strings dumped from <code>json.du... | [] | [
{
"body": "<ul>\n<li>You have a pile of unstructured, global code; this needs to be organized into functions and maybe classes</li>\n<li>Close your cursor once you're done with it, ideally via context management</li>\n<li>Order your query using the database itself, to make grouping less painful; also query in o... | {
"AcceptedAnswerId": "263294",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T08:01:46.040",
"Id": "263273",
"Score": "4",
"Tags": [
"python",
"performance",
"python-3.x",
"gui",
"pyqt"
],
"Title": "Python PyQt6 populate QTreeWidget with a list ... | 263273 |
<p>No problem yet with the code.</p>
<p>Here is a function that can be saved as add in and used as UDF in Microsoft excel to convert a number to text. For example, <code>4556.45</code> to <code>RUPEES Four Thousand Five Hundred Fifty Six & PAISE Forty Five</code> (Defaults being set to Indian Rupee). But the functi... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T06:40:13.720",
"Id": "519852",
"Score": "0",
"body": "For numbers, one can also refer to [Microsoft webpage](https://support.microsoft.com/en-us/office/convert-numbers-into-words-a0d166fb-e1ea-4090-95c8-69442cd55d98)"
},
{
"... | [
{
"body": "<p>After a <em>very</em> quick glance, at an absolute minimum, you should declare a specific <code>Type</code> for all your parameters and variables, and ensure that they're the <em>appropriate</em> type.</p>\n<p>For example, <code>CurrencyConversion</code> is a <code>Variant</code>, but it <em>shoul... | {
"AcceptedAnswerId": "263329",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T10:55:29.680",
"Id": "263277",
"Score": "6",
"Tags": [
"vba",
"excel"
],
"Title": "VBA - Excel add in Convert number to Text currency"
} | 263277 |
<blockquote>
<p>Write a program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month.</p>
<p>The following variables contain values as described below:</p>
<p><code>balance</code> - the outstanding balance on the credit card... | [] | [
{
"body": "<p>The <code>balances</code> function is a bit long. The contents of the loop can be another function. This function shall be responsible to satisfy this requirement:</p>\n<blockquote>\n<p>For each month, calculate statements on the monthly payment and remaining balance</p>\n</blockquote>\n<p>Instead... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T15:45:42.960",
"Id": "263287",
"Score": "3",
"Tags": [
"python",
"programming-challenge",
"generator"
],
"Title": "Q: Paying Debt Off a Year, MIT edX 6.001 U2/PS2/P1"
} | 263287 |
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/263183/231235">Two dimensional bicubic interpolation implementation in C</a> and <a href="https://codereview.stackexchange.com/q/257757/231235">A recursive_transform Template Function with Unwrap Level for Various Type Arbitrary Nested ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T18:31:30.963",
"Id": "519825",
"Score": "2",
"body": "Can't help but notice that the bug from last time (filling 9 out of 16 entries in `ndata`) is still in here"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2... | [
{
"body": "<p>I like <code>auto</code> for lots of things, but not as a return type unless it's actually necessary.</p>\n<p>For example, to understand what <code>cast</code> returns it's necessary to dig through several template functions, layers of meta-templates, and then understand what <code>std::invoke_res... | {
"AcceptedAnswerId": "263320",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T17:53:45.530",
"Id": "263289",
"Score": "3",
"Tags": [
"c++",
"reinventing-the-wheel",
"image",
"template",
"c++20"
],
"Title": "Two dimensional bicubic interpolation ... | 263289 |
<p>I have written a simple parser in Java for a study project. Can anyone see how I might improve the code below. I have been looking at the code myself for the last few days but I couldn't come up with anything.</p>
<pre><code>int counter = 0;
int cacheCounter = 0;
for(Map.Entry<String, File[]> path : queried... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T21:03:34.180",
"Id": "519836",
"Score": "3",
"body": "Hi @Vadym - is there a reason why you have counter (other than for debugging?). Perhaps some javadoc might help. And if one of the Files for that query is a directory you get al... | [
{
"body": "<p>First off, it would've been nice to see the entire method, or preferrably even the entire class. Having less context makes reviewing harder.</p>\n<p>That said, I feel there was enough for a review, so here goes.</p>\n<p>You call <code>file.listFiles</code> 3 times per file. It would probably be mo... | {
"AcceptedAnswerId": "263297",
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T19:35:34.947",
"Id": "263292",
"Score": "2",
"Tags": [
"java",
"spring"
],
"Title": "How can I rewrite the below parser code in Java"
} | 263292 |
<p>I am working on detection the selfish node based on this equation Using awk File : (Node Communication Ratio) NCR= ((Get Route Request-(Get Route Request-Reply Route Request))/Get Route Request)*100</p>
<p>Is the code correct?</p>
<pre><code>BEGIN {
ReqCounter=0;
RepCounter=0;
NCRCounter=0;
Normalcou... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T11:51:12.247",
"Id": "519861",
"Score": "2",
"body": "Net simulator NS-2 : As usual, an analyzing awk script must be a match for the trace.tr . ... If you want an answer, then the file.tcl or the trace.tr must be available."
},
... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T20:43:36.130",
"Id": "263295",
"Score": "1",
"Tags": [
"awk"
],
"Title": "detection the selfish node Using awk File"
} | 263295 |
<p>I made a trival snake game below to practice my C++ and Win32 programming skills.</p>
<pre><code>/* g++ snake.cpp -o snake -lgdi32 -Wl,-subsystem,windows */
#include <deque>
#include <vector>
#include <cstdio>
#include <ctime>
#include <Windows.h>
#define ID_TIMER 1
constexpr int W... | [] | [
{
"body": "<p><code>#define ID_TIMER 1</code></p>\n<p>Just because you're using it with Win32 API calls doesn't change the fact that MACROS==BAD, constexpr==good.</p>\n<pre><code>struct Cell\n{\n int row, col;\n Cell(int row, int col) : row(row), col(col)\n {}\n};\n</code></pre>\n<p>Your constructor do... | {
"AcceptedAnswerId": "263328",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-21T23:38:51.103",
"Id": "263298",
"Score": "2",
"Tags": [
"c++",
"windows",
"snake-game",
"winapi"
],
"Title": "Win32 Snake game"
} | 263298 |
<p>I use the following code in order to assess the quality of an audio, which is based on this <a href="https://github.com/lochenchou/MOSNet" rel="nofollow noreferrer">original-project: MOSNet</a>. I call <code>compute_mosnet_score()</code> in a loop with a different audio file in each iteration.</p>
<pre><code>import ... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T00:34:28.010",
"Id": "263299",
"Score": "2",
"Tags": [
"python",
"performance",
"tensorflow",
"keras"
],
"Title": "How to avoid retracing in tensorflow when predicting scores ... | 263299 |
<p>I created a rough implementation of a component that lists stuff based on data has the option to enable searching for that data. I've not used React all that much so it's probably a terrible way to implement it. I looked into passing state upwards and the most common way I saw was to do what I did and pass the sette... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T00:39:58.630",
"Id": "263302",
"Score": "4",
"Tags": [
"react.js",
"jsx"
],
"Title": "React - Show more and search functionality"
} | 263302 |
<p>In the process of trying to learn python, and also help my daughter with some elementary math practice over the summer, I'm trying to write a simple math quiz which will reinforce what she learned over the last year. I am using the following, which works okay:</p>
<pre><code>import random
import operator
def quiz()... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T08:52:23.787",
"Id": "519858",
"Score": "2",
"body": "Micro-review: comparing floating-point values with `==` is risky in any language, due to precision issues."
}
] | [
{
"body": "<p>You made a wise choice wanting to tango with the snake. Just as a mean teacher I will pick apart your code in excruciating detail. I really like your code for a beginner. It is clearly structured, it works and your naming is good.\nWith that being said, you do make some classical beginner mistakes... | {
"AcceptedAnswerId": "263308",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T05:08:43.533",
"Id": "263306",
"Score": "3",
"Tags": [
"python",
"beginner",
"python-3.x"
],
"Title": "Python Math Quiz"
} | 263306 |
<p>This script is my first-ever attempt at writing anything in python. Though I have an electrical engineering background and therefore got a little programming education in college, it was fairly limited and I am definitely no big-time coder, so much of this script may be very rudimentary. I've never touched a JSON ... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T05:20:15.243",
"Id": "263307",
"Score": "2",
"Tags": [
"python",
"mysql",
"json"
],
"Title": "Python script to collect NWS gridpoint forecast data (JSON) and push it into MariaDB"... | 263307 |
<p>Possible improvements I see are take <code>lastdigit_num</code> and implement <code>arr_{lastdigit_num}</code> since <a href="https://brilliant.org/wiki/finding-the-last-digit-of-a-power/#:%7E:text=Finding%20the%20last%20digit%20of%20a%20positive%20integer%20is%20the,division%20by%20n%20n%20n." rel="noreferrer">the ... | [] | [
{
"body": "<p>There's really no need to convert the inputs to <code>int</code>. We're only using the last digit of <code>a</code> and the last two digits of <code>b</code>. So just check that we don't have any non-digit characters, then convert the last one or two digits to <code>int</code>.</p>\n<p>The code ... | {
"AcceptedAnswerId": "263372",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T07:52:12.270",
"Id": "263312",
"Score": "10",
"Tags": [
"python",
"python-3.x"
],
"Title": "Last digit of any (reasonably large) a^b (Analytically)"
} | 263312 |
<p>I just completed my second python project which is a chess game.
At the moment I have included a mechanism for pieces to lock onto a square based on the nearest square when moved. And I have introduced a mechanism to take pieces. I haven't yet checked for legal moves but I plan on doing that soon.</p>
<p>If anyone c... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T08:35:07.373",
"Id": "263314",
"Score": "3",
"Tags": [
"python",
"beginner"
],
"Title": "Chess using pygame"
} | 263314 |
<p>This is the code that joins the list with another one. Also makes use of a static utility to makes use of hashmap for id and name.</p>
<p>I've added null checks to safeguard the code with NPE.</p>
<p>The key purpose is to make this readable. Could someone help code review this?</p>
<pre><code>public List<PGRating... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T11:12:08.820",
"Id": "519860",
"Score": "0",
"body": "Welcome to Code Review, please add an explanation about what the code does."
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T12:17:19.830",
"Id... | [
{
"body": "<p>One giant stream with nested streams with nested streams is very difficult to read. Streams are not a hammer, and not all problems are nails. Code should not try to ram things into streams when they make the card harder to read and understand.</p>\n<p>The line breaks here are not where I'd expect ... | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T10:17:29.760",
"Id": "263319",
"Score": "1",
"Tags": [
"java",
"lambda"
],
"Title": "How to make this nested lambda expression readable?"
} | 263319 |
<p>I am working on some claims data, where I have features such as</p>
<p><a href="https://i.stack.imgur.com/RtKbp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RtKbp.jpg" alt="claims data spreadsheet" /></a></p>
<p>The descriptions of the columns are: (A) the year of claim, (B) who's the insuring ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-07-12T15:57:58.847",
"Id": "521317",
"Score": "0",
"body": "It would be helpful if you could provide your spreadsheet data as csv (comma separated values). Preferably integrated into your post."
}
] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T13:11:17.940",
"Id": "263324",
"Score": "2",
"Tags": [
"python",
"hash-map",
"database",
"pandas"
],
"Title": "Compute damages and savings for motor insurance claims"
} | 263324 |
<h2>Here is my example structure:</h2>
<pre><code>.
├── App.jsx
├── index.js
└── src
└── components
├── Button.jsx
└── Header
└── Header.jsx
</code></pre>
<h2>Question:</h2>
<ol>
<li>Should I name Header.jsx inside Header folder? (I personally prefer this way insteade of <code>Header/ind... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T14:55:41.443",
"Id": "519870",
"Score": "1",
"body": "Welcome to the Code Review Community where we review working code you have written and provide suggestions on how to improve that code. I am voting to close this question because... | [
{
"body": "<h2>This is one of the possibilities I tried:</h2>\n<pre><code>.\n├── App.jsx\n├── index.js\n└── src\n └── components\n ├── Button.jsx\n ├── Drawer\n │ ├── Drawer.jsx\n │ ├── DrawerMobile.jsx\n │ └── components\n │ ├── DrawerTitle.jsx\n ... | {
"AcceptedAnswerId": null,
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T13:55:51.183",
"Id": "263325",
"Score": "-1",
"Tags": [
"javascript",
"react.js",
"vue.js"
],
"Title": "How do I distinguish the difference in naming and file structure between co... | 263325 |
<p>I do research and compare different numeric models to each other. Therefore, I want to easily switch out the numeric models in my simulations and evaluation code.</p>
<p>Some models work in cartesian coordinates, some in cylindrical coordinates. Some don't have a z-coordinate (yet), since they are primarily two-dime... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T16:55:06.693",
"Id": "519882",
"Score": "0",
"body": "This won't run. You haven't defined `DIPOL_POINT` and `POINTS`."
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T16:56:21.340",
"Id": "519883",... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "5",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T14:04:14.340",
"Id": "263327",
"Score": "4",
"Tags": [
"python",
"numpy",
"modules"
],
"Title": "How to structure and write exchangable calculation models (in python3 modules)?"
} | 263327 |
<p>The following code works fine to generate an array of 6 random values (or however many are specified by <code>iterations</code>). I'm wondering if there's a more concise way than using a <code>while</code> loop to achieve the same result.</p>
<pre><code>const seedValue = 31;
const iterations = 6;
let i = 0;
const ... | [] | [
{
"body": "<p>Probably not the most concise nor efficient, but it is an alternative in a sense that the approach is totally different and shorter than what you provided:</p>\n<p><div class=\"snippet\" data-lang=\"js\" data-hide=\"false\" data-console=\"true\" data-babel=\"false\">\r\n<div class=\"snippet-code\"... | {
"AcceptedAnswerId": "263331",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T15:12:59.963",
"Id": "263330",
"Score": "-1",
"Tags": [
"javascript"
],
"Title": "concise alternative to a while loop"
} | 263330 |
<h1>Create a <code>Time</code> class.</h1>
<p><a href="https://www.youtube.com/watch?v=rIE2GAqnFGw" rel="nofollow noreferrer">Time is on my side</a></p>
<h2>Specification</h2>
<ul>
<li><p>Basic attributes: hour, minute, second and day (default is 0), + getters, + setters (using a decorator)</p>
</li>
<li><p>If you try ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T16:19:53.093",
"Id": "519877",
"Score": "0",
"body": "If you can't represent the 61st second of a minute, what's supposed to happen when there's a leap second??"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "20... | [
{
"body": "<p>One small point:</p>\n<p>When we inherit from <code>Exception</code>, we get its (actually, <code>BaseException</code>'s) <code>str()</code> implementation, so we don't need to provide <code>__str__()</code> if we initialise the base class <code>args</code> with the required string:</p>\n<pre><cod... | {
"AcceptedAnswerId": null,
"CommentCount": "6",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T16:11:47.293",
"Id": "263332",
"Score": "2",
"Tags": [
"python",
"object-oriented",
"datetime",
"reinventing-the-wheel",
"homework"
],
"Title": "Create a Time class - OOP ... | 263332 |
<p>If the validation in <code>RestController</code> fails, I need to handle <code>MethodArgumentNotValidException</code> and provide an errorMessage, that contains
info about all rejected fields of passed object. If any rejected field has <code>@JsonProperty</code> annotation with non-empty value, then I need to replac... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T12:41:26.377",
"Id": "519942",
"Score": "1",
"body": "Welcome to the Code Review Community, is the code working as expected? We only review code that is working as expected. Please read [How do I ask a good question?](https://codere... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T17:11:31.850",
"Id": "263334",
"Score": "4",
"Tags": [
"java",
"json",
"error-handling",
"spring"
],
"Title": "Exception handling: using @JsonProperty value to make error mess... | 263334 |
<p>I am learning <code>Rust</code> and I would like to know what is the idiomatic way of writing a function that could run into multiple error types. For instance, in the function <code>get_account_with_creds</code> I am trying to return a struct <code>AccountForResponse</code> if the credentials match. The function co... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T18:54:18.943",
"Id": "519898",
"Score": "0",
"body": "The [anyhow crate](https://crates.io/crates/anyhow) might be what you're looking for."
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T19:01:42.837... | [
{
"body": "<ul>\n<li><p>If you expect to <em>handle</em> the errors (to recover from them in a way that is specific to which error occurred), or if you're writing a library, then define an <code>enum</code> type which can hold any of the errors might occur. Each enum variant might either contain the original er... | {
"AcceptedAnswerId": "263344",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T18:42:03.720",
"Id": "263338",
"Score": "2",
"Tags": [
"rust"
],
"Title": "Rust returning multiple errors"
} | 263338 |
<p>So I'm currently learning about networking between a client and a server and I decided to try to write my own client and server.</p>
<p>I implemented a way of receiving data and it goes as follows..</p>
<p>The server expects a packet that is structured like this.. <code>[ packetSize(2bytes), [data] ]</code>, so the ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T20:28:57.613",
"Id": "519904",
"Score": "0",
"body": "What is `_socket`? Could you provide more code?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T20:37:48.300",
"Id": "519906",
"Score": "0... | [
{
"body": "<p><em>Future note: avoid making Code Review request for not finished yet solution.</em></p>\n<p>Few notes:</p>\n<ul>\n<li>What I'm really missing here: <a href=\"https://docs.microsoft.com/en-us/dotnet/csharp/async\" rel=\"nofollow noreferrer\">Asynchronous programming</a></li>\n<li>There's no reaso... | {
"AcceptedAnswerId": null,
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T19:57:08.117",
"Id": "263339",
"Score": "1",
"Tags": [
"c#",
"networking",
"tcp"
],
"Title": "How to continiously read data from a NetworkStream"
} | 263339 |
<p>So far I have this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>const rand = (min, max) => Math.floor(Math.random() * (max - min + 1) + min)
// rule:
// if an ev... | [] | [
{
"body": "<h3>Correctness</h3>\n<p>First of all, your algorithm doesn't seem to implement the lattice state update correctly: as soon as you update the state of one cell, the neighbor counts of any adjacent cells will change. Usually this isn't supposed to happen: most CA are defined so that, conceptually, ev... | {
"AcceptedAnswerId": "263364",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T20:05:10.303",
"Id": "263340",
"Score": "3",
"Tags": [
"javascript",
"performance",
"ecmascript-6",
"cellular-automata"
],
"Title": "How to implement a 2D Cellular Automat... | 263340 |
<p>This code represents logic used to retry failed calls to a crypto exchange:</p>
<pre><code>let retries =
[
TimeSpan.FromSeconds(1.)
TimeSpan.FromSeconds(3.)
TimeSpan.FromSeconds(5.)
TimeSpan.FromSeconds(10.)
TimeSpan.FromSeconds(30.)
]
let rec retryAsync (retryAttemp... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T23:05:51.687",
"Id": "519912",
"Score": "1",
"body": "I don't have enough to add to make this a full answer, but as a beginner to `f#` I find this code easily understandable without your explanation. If your goal is to make this un... | [
{
"body": "<p>It looks understandable to me, here's a couple possible improvements:</p>\n<p><code>retryInterval</code> is more informative than <code>retries</code> (you could also specify that these are the defaults):</p>\n<pre class=\"lang-fs prettyprint-override\"><code>let defaultRetryIntervals =\n [\n ... | {
"AcceptedAnswerId": "264298",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T20:07:09.873",
"Id": "263341",
"Score": "2",
"Tags": [
"f#"
],
"Title": "Retrying failed calls to a crypto exchange"
} | 263341 |
<p>I have created <a href="https://pastebin.com/r3Ak50nA" rel="nofollow noreferrer">a rust program</a> to create <a href="https://mail.tm" rel="nofollow noreferrer">https://mail.tm</a> accounts, but I think there are things I could have done better. Are there things I can do to improve performance? Are there any unnece... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T20:18:16.923",
"Id": "263343",
"Score": "2",
"Tags": [
"multithreading",
"rust",
"concurrency",
"networking"
],
"Title": "Rust program to create mail.tm accounts"
} | 263343 |
<p>While learning about python tkinter, I decided to make a digital clock:</p>
<pre><code>from datetime import datetime
import tkinter as tk
from threading import Thread
import time
class clock():
def __init__(self):
self.display = tk.Tk()
def start(self):
def get():
self.... | [] | [
{
"body": "<p>To start, it's crucial that you stop creating a brand new label ten times a second. Just modify the existing one. Also, this is so simple that a class is not called for. Move as much as possible away from your thread, into your setup routine. Finally, your use of <code>%H</code> is likely incorrec... | {
"AcceptedAnswerId": "263348",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-22T21:43:26.403",
"Id": "263346",
"Score": "7",
"Tags": [
"python",
"tkinter",
"timer"
],
"Title": "Digital clock with Python Tkinter"
} | 263346 |
<p>All this does is safely and reliably opens, writes to, and closes the file. Yet there are so many <code>goto</code>s and the code is quite verbose. I am not even sure that all of what I am doing is necessary.</p>
<pre><code>int WriteConfig(void) {
FILE *ConfigFile;
RetryOpen:
if (!(ConfigFile = fopen(Config,... | [] | [
{
"body": "<p>The identifiers are highly confusing - we have <code>Conf</code>, <code>Config</code>, <code>struct Config</code> and <code>ConfigFile</code>. I can't tell without re-reading the code what each one means. We also have two labels whose difference is hard to deduce from their names.</p>\n<p>Why ar... | {
"AcceptedAnswerId": "263355",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T03:53:47.317",
"Id": "263350",
"Score": "1",
"Tags": [
"performance",
"c",
"error-handling",
"portability"
],
"Title": "Open, writing to, and closing a configuration file,... | 263350 |
<p>I want to share a little app I made that logs tracks I play on Spotify (running in the background on my <a href="https://www.digitalocean.com/" rel="nofollow noreferrer">DigitalOcean</a> droplet server). It uses <a href="https://spotipy.readthedocs.io/en/2.18.0/" rel="nofollow noreferrer">Spotipy</a>, a lightweight ... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T07:30:49.463",
"Id": "263354",
"Score": "1",
"Tags": [
"python",
"spotipy"
],
"Title": "Spotify logger for tracks played"
} | 263354 |
<p>This script solves a simple problem:</p>
<p>Input two strings differ one character or zero characters in length, return true if the following conditions are met:</p>
<p>1, They must start with same character and end with same character.</p>
<p>2, One string can be obtained by changing one character or zero character... | [] | [
{
"body": "<p>It would be good to include a docstring explaining the parameters and expected result. Best of all would be to include the unit-tests in <code>doctest</code> format:</p>\n<pre><code>def fuzzymatch(str1, str2):\n """\n Returns True if the two strings differ by only one letter ... | {
"AcceptedAnswerId": "263358",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T08:44:05.360",
"Id": "263356",
"Score": "6",
"Tags": [
"python",
"performance",
"beginner",
"python-3.x"
],
"Title": "Python: determine whether one string can be obtained ... | 263356 |
<p>This is a follow-up of my last question over <a href="https://codereview.stackexchange.com/q/262883/242934">here</a>.</p>
<p>Following @Reinderien's <a href="https://codereview.stackexchange.com/a/263305/242934">suggestion</a> in that previous post, I've managed to furnish my web-scraper code as follows:</p>
<h1>fud... | [] | [
{
"body": "<ul>\n<li>Distinguish between your Link and Result classes; I've renamed the latter to Article</li>\n<li>Publication is the same for every row so I've omitted it. You can reintroduce it if you really want, but it's strange to have to hard-code a value that's the same for every record in a file.</li>\... | {
"AcceptedAnswerId": "263375",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T08:56:05.610",
"Id": "263357",
"Score": "4",
"Tags": [
"python",
"web-scraping"
],
"Title": "Use of dataclass when scraping with Requests"
} | 263357 |
<p><strong>Problem statement:</strong>
I have the following access log, get the count by timestamp(hh:mm) and sort the count based on minute. And write it into the CSV file.</p>
<p><code>access.log:</code></p>
<pre><code>172.16.0.3 - - [25/Sep/2002:14:04:19 +0200] "GET /api/endpoint HTTP/1.1" 401 80500 "... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T13:17:37.450",
"Id": "519953",
"Score": "1",
"body": "Why is this being done in the first place? There are multiple strange things going on here, including that you're divorcing the time from the date. Is this for some kind of log t... | [
{
"body": "<pre class=\"lang-py prettyprint-override\"><code>log_list = {}\n...\n if hh_mm in log_list:\n log_list[hh_mm] += 1\n else:\n log_list[hh_mm] = 1\n...\n</code></pre>\n<p>This can be replaced with a <code>Counter</code> where unknown keys default to ... | {
"AcceptedAnswerId": null,
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T11:01:14.770",
"Id": "263360",
"Score": "3",
"Tags": [
"python"
],
"Title": "Parsing log file and returning timestamp ordered output"
} | 263360 |
<p>For a job in company I had to do a code assignment. My assignment performs all the required tasks needed to be done. But after one month the company provided me a feedback and said that <strong>we have reviewed your exercise, very sorry for the delay. Unfortunately, while working, the structure and readability of th... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-25T02:56:09.300",
"Id": "520073",
"Score": "0",
"body": "The over arching issue I see is a lack of separation of concerns. You have game logic in your view."
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-08-0... | [
{
"body": "<p>First there's some low hanging fruit. Perpetual use of <code>self.</code> when not needed. Use of parens when not needed. Inconsistent formatting (sometimes you put a space before the open brace, sometimes you don't. Sometimes you put code after a close brace on the same line, sometimes you don't.... | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T12:45:11.217",
"Id": "263363",
"Score": "3",
"Tags": [
"swift",
"ios",
"swiftui"
],
"Title": "Structure and readability of the code in swift ios"
} | 263363 |
<p>I'm currently writing a game of life with small extra features but I ran into a problem - in my first try i decided to use simple list of Cell objects:</p>
<pre><code>class Cell:
def __init__(self, x, y, is_alive):
self.is_alive = is_alive
self.x = x
self.y = y
self.will_be_alive ... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T15:14:56.350",
"Id": "519963",
"Score": "0",
"body": "What do you mean by \"20 fps less\"? Are you recreating an array every frame? There are several possible causes starting with some Python implementation details and up to CPU cac... | [] | {
"AcceptedAnswerId": null,
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T14:11:46.213",
"Id": "263367",
"Score": "2",
"Tags": [
"python",
"pygame",
"game-of-life"
],
"Title": "One data object instead of array of objects - why is it slower?"
} | 263367 |
<p>This is a follow-up of my question over <a href="https://codereview.stackexchange.com/q/262883/242934">here</a>.</p>
<p>I have been working on my web-scraping techniques by trying out different approaches and rewriting code for a handful of online databases.</p>
<p>I've recently seen for myself that <code>requests</... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T15:39:36.507",
"Id": "263373",
"Score": "2",
"Tags": [
"python",
"web-scraping"
],
"Title": "requests vs selenium vs scrapy"
} | 263373 |
<p>I've found pretty simple problem on <a href="https://www.youtube.com/watch?v=N92w4e-hrA4" rel="nofollow noreferrer">Numberphiles channel</a>: suppose we have a recursive function
<span class="math-container">$$
\begin{equation}
\begin{split}
f_0 &= Z ^ 2+ C \\
f_i &= f_{i-1}^2 + C \; | \; i = 1 \dots
\end{s... | [] | [
{
"body": "<p>By inspection, we can eliminate <span class=\"math-container\">\\$a = 0\\$</span> from the search, since that would result in <span class=\"math-container\">\\$f_i = C\\$</span> which yields a cycle of length 1.</p>\n<p>Since you are computing <span class=\"math-container\">\\$Z^2\\$</span>, we ca... | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T15:41:28.947",
"Id": "263374",
"Score": "1",
"Tags": [
"performance",
"haskell",
"mathematics"
],
"Title": "Find circles for `f(z, c) = z ^ 2 + c` of length 6 in rational numbers"... | 263374 |
<p>I am working on a project, neurodecode, which uses a logger based on the <code>logging</code> library. As I am not very familiar with logging, I don't know how to further improve this aspect of the project.</p>
<p>The project is constructed as:</p>
<pre><code>neurodecode
|_ __init__.py
|_ logger.py
|_ folder1
|_... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-27T18:56:58.957",
"Id": "520245",
"Score": "0",
"body": "See also https://stackoverflow.com/a/68154386/313768"
}
] | [
{
"body": "<p>Part of your interface accepts strings as levels, and you have a string-level mapping. Why? There are standard symbols available from the logging library for anyone to use. There is no advantage to passing around stringly-typed levels, and in fact the standard levels being integral is a feature. I... | {
"AcceptedAnswerId": "263521",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T16:10:37.363",
"Id": "263376",
"Score": "4",
"Tags": [
"python",
"python-3.x",
"logging"
],
"Title": "Improvements to logger and how to correctly use it"
} | 263376 |
<p>I made simple scripting language (interpreter) in C and now, I want to make my code better.</p>
<p>Here is my code:</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TRUE (1 == 1)
#define FALSE (1 == 0)
#define FUNCTION_NAME_COUNT 2
#define FUNCTION_ARG_FUNCTION_NA... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T18:30:31.213",
"Id": "519980",
"Score": "2",
"body": "Curious, why `#define TRUE (1 == 1)` instead of `true` from `<stdbool.h>`?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T18:52:00.857",
"Id"... | [
{
"body": "<p><strong>Potential bug</strong></p>\n<p><code>str[strlen(str) - 1]</code> is <em>undefined behavior</em> when <code>str[0] == 0</code>. Instead use a <em>logical</em> AND.</p>\n<pre><code>// if (str[0] == '"' & str[strlen(str) - 1] == '"') \nif (str[0] == '"' && str[strl... | {
"AcceptedAnswerId": "263381",
"CommentCount": "4",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T16:12:02.997",
"Id": "263377",
"Score": "5",
"Tags": [
"c",
"interpreter"
],
"Title": "Simple scripting language (interpreter) in C"
} | 263377 |
<p>I have created <code>calculateMinimumAmount</code> to calculate the minimum buy/sell amount that exchange will allow the spot order to be placed based on the current price.</p>
<p>The exchange I used (FTT) does not limit the minimum order amount by value (like Binance needed at least 10 USD per order) but by a token... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T17:46:03.230",
"Id": "263380",
"Score": "0",
"Tags": [
"javascript",
"algorithm",
"typescript"
],
"Title": "Calculate minimum buy/sell amount that exchange will allow the order to... | 263380 |
<p>So I've just started teaching myself C++ a few weeks ago and I've decided to work on an implementation of Tic Tac Toe, using the command line. The program allows a human to play against a bot, which simply selects a random location on the board. I'm requesting a review because I'm not sure about a few things that I'... | [] | [
{
"body": "<h1>General Observations</h1>\n<h2>The Good</h2>\n<p>No global variables!<br />\nNice consistent indentation.<br />\nGood use of functions.</p>\n<h2>Could be Better</h2>\n<p>The code looks too much like C and not enough like C++. There is no use of C++ container classes such as <a href=\"https://en.c... | {
"AcceptedAnswerId": "263388",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-23T20:57:23.893",
"Id": "263385",
"Score": "3",
"Tags": [
"c++",
"beginner",
"tic-tac-toe"
],
"Title": "A TicTacToe command line game in c++"
} | 263385 |
<p>I'm writing a (compile-time-)fixed-width unsigned big integer. To implement subtraction, a subtract-with-borrow primitive is required. When efficient platform-specific implementation isn't available (e.g. x86_64's <code>_subborrow_u64</code> intrinsic), it needs to be implemented in Standard C++.</p>
<p>I've been ab... | [] | [
{
"body": "<p>Your intuition is correct, but the issue is that your add_with_carry lacks the carry propagation in subtract_with_borrow.</p>\n<p>That's a general observation - if the new code looks more complicated than the old code, you should also consider that the old code lacked something.</p>\n<p>Consider t... | {
"AcceptedAnswerId": "263396",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T01:18:08.347",
"Id": "263389",
"Score": "1",
"Tags": [
"c++",
"performance",
"algorithm",
"integer",
"c++20"
],
"Title": "Unsigned 64bit subtract-with-borrow in Standa... | 263389 |
<p>This code scrapes <a href="http://www.oddsportal.com" rel="nofollow noreferrer">www.oddsportal.com</a> for all the URLs provided in the code and appends it to a dataframe.</p>
<p>I am not very well versed with iterative logic hence I am finding it difficult to improvise on it.</p>
<p>Code:</p>
<pre><code>import pand... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T12:55:51.130",
"Id": "520028",
"Score": "2",
"body": "Asking for this code to be reviewed is fine, but asking for net new features to be added is off topic"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06... | [
{
"body": "<ul>\n<li>It seems that <code>GameData</code> is meant to house multiple games, with lists for each attribute. You should re-represent this as a list of <code>GameData</code> instances where each instance has a scalar for each attribute and not a list.</li>\n<li>Using Selenium is not out of the quest... | {
"AcceptedAnswerId": null,
"CommentCount": "7",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T05:07:09.590",
"Id": "263390",
"Score": "-1",
"Tags": [
"python",
"performance",
"iterator",
"beautifulsoup"
],
"Title": "Scraping odds portal with beautiful soup"
} | 263390 |
<p>This project is the natural extension to <a href="https://codereview.stackexchange.com/questions/263265/c20-coroutine-generator">my attempt to make a templated<code>generator</code> coroutine</a>. This time, I tried what I called a "<code>task</code>" (may be not the real term for this) : it generates a va... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T05:31:31.313",
"Id": "263391",
"Score": "3",
"Tags": [
"c++",
"c++20"
],
"Title": "C++20 Coroutine Task"
} | 263391 |
<p>I am trying to implement a shopping cart using redux-saga. The following code is working fine. But it does not look right to me. I am mutating the cart whenever I am adding the product. Let me know if I can improve the code. If this is the case.</p>
<pre><code>import { takeEvery, put } from 'redux-saga/effects';
imp... | [] | [] | {
"AcceptedAnswerId": null,
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T07:48:08.577",
"Id": "263394",
"Score": "0",
"Tags": [
"javascript",
"react.js",
"redux"
],
"Title": "Mutating the shopping cart using redux-saga"
} | 263394 |
<p>I have two lists, I need to make another list with the same elements than the other lists. But elements on this list need the next sequence.</p>
<blockquote>
<p>list1[0], list2[0], list1[1], list2[1], ... and so on</p>
</blockquote>
<p>for that, I made this code.</p>
<pre><code>List<string> list1 = new List<... | [] | [
{
"body": "<p>The simplest solution I can think of</p>\n<pre><code>var interleavingMergedLists = list1\n .Zip(list2, (lhs, rhs) => new[] {lhs, rhs})\n .SelectMany(l => l)\n .ToList(); \n</code></pre>\n<ol>\n<li>Rather than creating a new anonymous object / ValueTuple instead create an array.</li>\n<li>... | {
"AcceptedAnswerId": "263451",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T08:22:23.277",
"Id": "263397",
"Score": "1",
"Tags": [
"c#"
],
"Title": "Combine elements of two lists into another list"
} | 263397 |
<p>These are the scripts I wrote to generate valid ngrams, the output will be filtered manually then used in Markov chain style pseudoword generation.</p>
<p>You will need <strike>PowerShell 7</strike> and <a href="https://www.ibiblio.org/webster/" rel="nofollow noreferrer">gcide_xml</a> to make these scripts work.</p>... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T13:34:57.433",
"Id": "520030",
"Score": "0",
"body": "Sharing the `gcide_dict.txt` might be useful to the reviewers"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-26T20:10:22.330",
"Id": "520198",
... | [
{
"body": "<h1>document parts of a program</h1>\n<p>It's good to document things in general, but it's especially important to document a data pipeline consisting of several process steps. Clearly label what each file is, and what each program takes in and outputs. For example:</p>\n<pre><code>gcide/*.xml: An en... | {
"AcceptedAnswerId": "267616",
"CommentCount": "3",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T10:38:40.277",
"Id": "263399",
"Score": "4",
"Tags": [
"python",
"performance",
"beginner",
"python-3.x"
],
"Title": "Python scripts that generate valid ngrams for use in ... | 263399 |
<p>I've tried to make a little library in C++, to gather all useful and necessary functions. I wrote the code(in one file, to make it more portable). Unfortunately, it works on Windows only.</p>
<pre><code>#pragma once
#ifndef NEWCPP
#define NEWCPP
#include <iostream>
#include <windows.h>
#... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T13:43:59.333",
"Id": "520032",
"Score": "4",
"body": "`GnomeSort` and `BubbleSort` are useful and necessary on Windows? Glad I never had to write anything for that platform!"
}
] | [
{
"body": "<h1>General Observations</h1>\n<blockquote>\n<p>Can it be done in other way? For example, I can write code in multiple files, but then compile into one .lib file? If so, how to install it then?</p>\n</blockquote>\n<p>Generally it is best to put functions into C++ source files and have header files th... | {
"AcceptedAnswerId": "263420",
"CommentCount": "1",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T10:57:36.437",
"Id": "263400",
"Score": "5",
"Tags": [
"c++",
"beginner",
"windows",
"library"
],
"Title": "My little C++ library for comfortable programming"
} | 263400 |
<p>This is a simple practice problem. The task is to write a function <code>getLR</code> that receives an <code>Integral</code>, <code>n</code>, and returns a list representation (LR) of <code>n</code>. For example: <code>73847 -> [7,3,8,4,7]</code>. Negative numbers return the LR of the absolute value, for example:... | [] | [
{
"body": "<p>I'm not a Haskell programmer, but let me just point out a few things here.</p>\n<p>First, expressions such as <code>(n-10^i*(n`div`(10^i)))</code> look quite cluttered. One thing you can do is just put a space between each operator and its operands, and with longer expressions, you can extract pie... | {
"AcceptedAnswerId": "263409",
"CommentCount": "0",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T11:04:29.470",
"Id": "263401",
"Score": "3",
"Tags": [
"haskell",
"recursion",
"functional-programming"
],
"Title": "Haskell Function to get the List representation of an Inte... | 263401 |
<p>Any help with my code. I think it's kind of hard code where I want to extract links from a page and download them.</p>
<p>It's going to scrape some links from websites (but the <code>Scraper</code> function that I've written is hardcode) and download the videos if they exist and I'm sure it's not good at all and it'... | [
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T16:46:08.787",
"Id": "520047",
"Score": "0",
"body": "What is an example of a page URL that this can accept?"
},
{
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T17:31:04.820",
"Id": "520052",
"Sco... | [
{
"body": "<p>A few suggestions.</p>\n<p>It's good that you are using a <strong>session</strong> but you are not using it properly. The idea is to reuse the session across your code to increase efficiency while crawling sites. It is used in the login routine but in the Scraper routine you are using a plain requ... | {
"AcceptedAnswerId": "263428",
"CommentCount": "2",
"ContentLicense": "CC BY-SA 4.0",
"CreationDate": "2021-06-24T11:40:02.000",
"Id": "263403",
"Score": "2",
"Tags": [
"python",
"web-scraping"
],
"Title": "Simple Scraper_Downloader based on Youtube-dl"
} | 263403 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.