body
stringlengths
25
86.7k
comments
list
answers
list
meta_data
dict
question_id
stringlengths
1
6
<p>I have a list of files that conform to a template like this:</p> <pre><code>XXX_{project}_{variation}---XXX.html </code></pre> <p>and</p> <pre><code>XXX_{project}_{variation}.html </code></pre> <p>The <code>variation</code> is not always present, so there are also files like this: <code>XXX_{project}---XXX.html</cod...
[]
[ { "body": "<p>Personally I don't think it's too long. It was fairly easy to read, especially with the good names.</p>\n<p>Here's a few things that could improve it:</p>\n<ul>\n<li>Use early returns instead of nested if's. This makes it even easier to read. Also, you don't need the packageName variable</li>\n<li...
{ "AcceptedAnswerId": "263424", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T12:52:09.613", "Id": "263406", "Score": "2", "Tags": [ "javascript", "strings" ], "Title": "Check if array of strings have the same substring" }
263406
<p>I have some code I've written which I need a review of (if possible) as I know I have a bug somewhere. Most likely due to my (lack) of understanding of some concepts in ElasticSearch and Spring.</p> <p>For context: I have a simple Spring boot API which allows students to add their college projects. These projects ar...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T14:08:11.777", "Id": "263410", "Score": "1", "Tags": [ "java", "spring", "elasticsearch" ], "Title": "Spring Boot Elastic Seemingly ignoring second Query" }
263410
<p>I share an algorithm that I have written myself. It is useful for incrementing any digit of a decimal number. That way, a conversion to decimal is not necessary.</p> <p>Please excuse the mistakes. I am learning assembler and x86 architecture. I am sure that it is possible to improve and optimize it (thank you). This...
[]
[ { "body": "\n<blockquote>\n<p>This code obviously uses recursion.</p>\n</blockquote>\n<p>That's not the case. For recursion your <em>INCREMENT</em> routine would have to <code>call</code> itself which it doesn't. The <em>INCREMENT</em> subroutine simply iterates over the characters in the text.</p>\n<p>You're r...
{ "AcceptedAnswerId": "263499", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T14:23:18.200", "Id": "263411", "Score": "6", "Tags": [ "algorithm", "converting", "assembly", "x86", "nasm" ], "Title": "Assembler. Algorithm for incrementing a decima...
263411
<p>This is only one of the first apps I've built with Node, React and TypeScript. I was wondering what could be made better. This is at this point the best I've been able to come up with, but I'm not sure if there's code here that could be difficult for another developer to read, could be improved, or anything else rea...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T18:12:39.370", "Id": "520176", "Score": "0", "body": "What do you want to achieve? Do you want to improve the code somehow? Consider adding a paragraph explaining what you tried, and specifying what you would like to improve or fix....
[ { "body": "<h2>general</h2>\n<h3>a</h3>\n<p>You want to use <code>typescript</code> this is a good practice to use type for your function or const or state.</p>\n<p>Example :</p>\n<pre><code>function something (a: string, b: boolean): void {\n // ....\n}\n\nconst something: void = (a: string, b: boolean) =&gt;...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T15:24:07.253", "Id": "263413", "Score": "2", "Tags": [ "node.js", "react.js", "typescript" ], "Title": "TypeScript, React and Node app to get 'games' data from a database and disp...
263413
<p>I am writing a Settlers of Catan server in Haskell for fun. Currently I am passing around state manually. I want to learn more about the State monad and want to incorporate it into my project.</p> <p>However, my GameState has multiple data constructors that I pattern match on to yield different functionality. Three ...
[]
[ { "body": "<p>In general, you would extract the state using <code>get</code> and then case-match on it, like so:</p>\n<pre><code>type Game = State GameState\n\ndoConstructBuilding :: Building -&gt; VertexCoordinate -&gt; Game ()\ndoConstructBuilding building coord = do\n gs &lt;- get\n case gs of\n SetupPh...
{ "AcceptedAnswerId": "263432", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T16:37:57.867", "Id": "263414", "Score": "1", "Tags": [ "haskell", "state", "pattern-matching" ], "Title": "State monad and pattern matching on data constructors" }
263414
<p>As a part of coursework, I had to build an UPGMA tree from a given distance matrix and a list of species names. As a beginner/intermediate in python I saw this as a good opportunity to learn about classes. The code is as follows:</p> <pre><code>&quot;&quot;&quot; UPGMA - Unweighted pair group method using arithmetic...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T17:21:02.167", "Id": "263416", "Score": "0", "Tags": [ "python", "python-3.x" ], "Title": "UPGMA tree building in python" }
263416
<p>This code calculates the probability of a runner finishing 3rd and it works like expected. I'm pretty sure though that is woefully inefficient. How could this code be transformed in a much more cleaner and performance efficient way? My focus is the nested fors and and the if handlings.</p> <pre><code>def Trd(mylist=...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T19:06:32.267", "Id": "520054", "Score": "4", "body": "Welcome to Code Review! Please [edit] your question so that the title describes the *purpose* of the code, rather than its *mechanism*. We really need to understand the motivati...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T17:22:26.783", "Id": "263417", "Score": "2", "Tags": [ "python", "performance" ], "Title": "Calculating Probabilities" }
263417
<p>My attempt at multiple linear regression.</p> <p>I am trying to make a qualified guess about a user's rating of a movie, through machine learning. I am new to this, so my judgement isn't the best. And I am also getting a result but I have no idea if it is the result I want.</p> <p>The code is setting up a finite sel...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T17:22:44.207", "Id": "263418", "Score": "0", "Tags": [ "python", "statistics", "machine-learning" ], "Title": "Predicting with multiple independent hot-encoded variables" }
263418
<h1>Problem</h1> <p>A function solution(w, h, s) that takes 3 integers and returns the number of unique, non-equivalent configurations that can be found on a grid w blocks wide, h blocks tall and s possible states.</p> <p>Equivalency is defined as above: any two grids each with same state where the actual order of the ...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T18:33:59.487", "Id": "263421", "Score": "1", "Tags": [ "python", "python-3.x", "programming-challenge", "mathematics" ], "Title": "Applied Solution Based On Polya Enumeration ...
263421
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/263289/231235">Two dimensional bicubic interpolation implementation in C++</a> and <a href="https://codereview.stackexchange.com/q/263024/231235">Two dimensional gaussian image generator in C</a>. Based on <a href="https://codereview.st...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T22:58:04.437", "Id": "520524", "Score": "0", "body": "You mean \"developed by Jimmy Hu\"." } ]
[ { "body": "<p>You are obviously on a fantastic quest to understand how to implement image processing operations in all sorts of languages. The tag <a href=\"/questions/tagged/reinventing-the-wheel\" class=\"post-tag\" title=\"show questions tagged &#39;reinventing-the-wheel&#39;\" rel=\"tag\">reinventing-the-wh...
{ "AcceptedAnswerId": "263492", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T18:40:12.713", "Id": "263422", "Score": "7", "Tags": [ "c++", "reinventing-the-wheel", "image", "template", "c++20" ], "Title": "Two dimensional gaussian image generat...
263422
<p>I have written some javascript code for a multilanguage site. The code works great but I feel like I have a lot of duplicate code. I was wondering if someone can explain how I can make this simpler or minimized. I have tried to use a <code>forEach(function (item, index)</code> but it does not seem to be working.</p>...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T08:53:12.110", "Id": "520092", "Score": "2", "body": "What does your code attempt to do (tasks)?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T16:27:30.817", "Id": "520126", "Score": "0", ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T18:56:19.950", "Id": "263423", "Score": "3", "Tags": [ "javascript", "i18n" ], "Title": "Language switcher for a multilingual site" }
263423
<p>Put together a <code>RadioMenu</code> class that can use a Enum to generate a Single-Selection Radio Button Menu. My main question is about whether there's a way to remove the need to pass in the Class of the Enum to the <code>generateButtonsFromEnum()</code> method. Otherwise, would appreciate any general pointers ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T09:01:49.893", "Id": "520095", "Score": "1", "body": "may i ask if you are allowed to use `RadioOptions[] values = RadioOptions.values();` ? doing so you could directly add all possible values (i don't know your assets)." }, { ...
[ { "body": "<h2>dependency injection</h2>\n<p>with the feedback from your comments i would provide those <code>&lt;T extends Enum&lt;T&gt;&gt;</code> that you want to use already in your constructor. That would remove the <em>not-so-handy</em> method <code>generateButtonsFromEnum</code>.</p>\n<pre><code>public e...
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T19:48:00.380", "Id": "263425", "Score": "1", "Tags": [ "java", "swing", "enum", "awt" ], "Title": "Generate and Control JMenu Radio Buttons Using An Enum" }
263425
<p>I have a function which checks for a profile name and determines if it is in a tagged profile name.</p> <pre><code>def check_profiles(request): try: # get all individual profiles profiles = Profile.objects.all() # get all individual tagged profiles tagged_profiles = TaggedProfiles.objects.all() #...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T19:50:28.657", "Id": "263426", "Score": "1", "Tags": [ "performance", "django" ], "Title": "Check if Profile name is contained in Tagged Profile names: added link" }
263426
<p>In order to reduce time complexity, instead of loading (and then dumping to use it for later) the whole file into an array (It would be O(n) with n=number of lines), I have saved it as array into a PHP file and included it</p> <p><strong>index.php</strong></p> <pre class="lang-php prettyprint-override"><code>&lt;?ph...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T00:29:16.807", "Id": "520068", "Score": "2", "body": "Splatpacking is not more efficient versus `array_values()`. https://stackoverflow.com/q/57725811/2943403 ...do you need to?" }, { "ContentLicense": "CC BY-SA 4.0", "C...
[]
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T20:59:41.300", "Id": "263429", "Score": "2", "Tags": [ "php", "object-oriented", "array" ], "Title": "editing the array I've included instead of editing the file of included array...
263429
<p>In a recruitment process, the company gives me a project to do in react native. I finished all the tasks. But company gave me a feedback and said that your project was good, but you did not <strong>apply best practices for using rest api</strong>. So we are not proceeding further with your application. I used redux ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T00:06:03.220", "Id": "520064", "Score": "0", "body": "Welcome to Code Review! I [changed the title](https://codereview.stackexchange.com/posts/263431/revisions) so that it describes what the code does per [site goals](https://codere...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T21:18:53.223", "Id": "263431", "Score": "0", "Tags": [ "interview-questions", "react.js", "rest", "redux", "react-native" ], "Title": "REST API in react native" }
263431
<p>This is a scraper written to do most of what had been attempted by another user in this question:</p> <p><a href="https://codereview.stackexchange.com/questions/263390/how-can-i-optimise-this-webscraping-code">How can I optimise this webscraping code</a></p> <p>I did the rewrite because I felt bad that the new user ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T18:38:38.257", "Id": "520135", "Score": "0", "body": "What are your objectives? Your code looks quite WET, and the use of a single god class looks questionable. You could probably have more maintainable code by using `dataclasses.fi...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-24T22:27:42.993", "Id": "263433", "Score": "3", "Tags": [ "python", "web-scraping", "rags-to-riches" ], "Title": "Scraping OddsPortal with requests only" }
263433
<p>This is my first C program. The code works, however I'm not yet familiar with how to write <em>idiomatic</em> C. How should I improve this?</p> <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; #define UNCLICKED 0 #define CLICKED 1 #define FLAG...
[]
[ { "body": "<p>One thing that strikes me immediately is that we pass <code>struct piece board[8][8]</code> around quite a lot. There's two things I would change there. The first is to use a typedef (or perhaps a small struct) to save all that typing. The other would be to give names to the dimensions.</p>\n<p...
{ "AcceptedAnswerId": "263447", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T00:59:41.120", "Id": "263436", "Score": "5", "Tags": [ "beginner", "c", "minesweeper" ], "Title": "Text Based Minesweeper in C" }
263436
<p>Below is my implementation of a persistent red black tree in Rust.</p> <p>I have a few questions about potential improvements. Currently the data and nodes are stored in referenced counted pointers. Is this the best way to do it?</p> <p>On a similar note, the pattern matching statements for the balance functions are...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T04:08:39.957", "Id": "520158", "Score": "0", "body": "Is there a reason for `#[allow(clippy::module_inception)]`? Generally, when a lint is triggered, we fix the code rather than disable the lint. The same goes for `#[allow(clippy...
[ { "body": "<p>In Rust, we don't usually create the style of object where the mutation functions return new objects. Even if the internal data structure is persistent, it fits better in Rust style to have mutating functions. So your insert function might be something more like this:</p>\n<pre><code> pub fn in...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T01:06:58.223", "Id": "263438", "Score": "4", "Tags": [ "beginner", "algorithm", "rust", "memory-management" ], "Title": "Rust Persistent Red Black Tree Implementation" }
263438
<p>In the code below, the primary purpose of <code>class MyRNG</code> is to create a single method <code>getMyRandom()</code> that will return a random number from any of several very different distributions and generators. The actual distribution and generator will be determined by information read from a file, althou...
[]
[ { "body": "<p>A lot of the time, if you want to group some objects by a type, the cleanest approach is... well, making <em>types</em>. Classes.</p>\n<p>It seems natural to me to start without the <code>enum</code>, instead beginning with <code>MyRNG</code> as an <code>interface</code>. The <code>MyRNG</code> <e...
{ "AcceptedAnswerId": "263442", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T01:41:13.807", "Id": "263439", "Score": "6", "Tags": [ "java", "object-oriented", "design-patterns" ], "Title": "Using a generic call to access different variations of a metho...
263439
<p>This is a follow-up of my question over <a href="https://codereview.stackexchange.com/a/262830/242934">here</a>.</p> <p>I am extending the functionality of @Reinderien's suggested code to enable the automatic looping through of pages in the search result.</p> <p>I've mainly modified the final <code>search()</code> f...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T16:32:46.437", "Id": "520130", "Score": "0", "body": "Removed the original buggy code, should be more concise and clear now." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T23:50:45.823", "Id": "5...
[ { "body": "<p>Most of the improvements are needed in <code>number_of_articles_and_pages</code>:</p>\n<ul>\n<li>The type hint is incorrect; you're not just returning a single integer but a tuple of them</li>\n<li>Your xpath expression is of a verbose and fragile form that relies overly on full tree traversal and...
{ "AcceptedAnswerId": "263501", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T04:01:37.090", "Id": "263443", "Score": "2", "Tags": [ "python", "web-scraping", "selenium" ], "Title": "Looping through search results in Selenium" }
263443
<p>You can only kill off a given number of heads at each hit and corresponding number of heads grow back. The heads will not grow back if the <a href="https://en.wikipedia.org/wiki/Lernaean_Hydra" rel="noreferrer">hydra</a> is left with zero heads. For example:</p> <pre><code>heads = [135] hits = [25,67,1,62] growths =...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T05:43:06.297", "Id": "520079", "Score": "1", "body": "Can you overkill a hydra? If the hydra has 20 heads can you cut off 26?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T05:58:11.777", "Id": "...
[ { "body": "<h3>Code feedback</h3>\n<ul>\n<li><strong>Use a linter!</strong> You have many inconsistencies in your code that suggests you are not using any type of autoformater for your code. This is strongly suggested. I like to use <code>black</code>, but there are many other variants.</li>\n<li><strong>Struct...
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T04:24:32.917", "Id": "263444", "Score": "5", "Tags": [ "python-3.x" ], "Title": "Killing a hydra" }
263444
<p>Sum of 2 numbers, represented with linked lists, where digits are in backward order or forward order.</p> <p><strong>Backward order Example</strong></p> <ul> <li>INPUT:(7-&gt;1-&gt;6) + (5-&gt;9-&gt;2) = 617+295</li> <li>OUTPUT: 2-&gt;1-&gt;9 = 912</li> </ul> <p><strong>Forward order Example</strong></p> <ul> <li>IN...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T08:59:38.730", "Id": "520094", "Score": "0", "body": "Hello, are you sure your code is working as expected ?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T09:44:13.850", "Id": "520098", "Sco...
[ { "body": "<p>There are two main suggestions I would recommend:</p>\n<ol>\n<li>Use separate methods to reuse code when able to.</li>\n<li>Take advantage of the tools already in the Java library.</li>\n</ol>\n<p><code>LinkedList</code> already has a method built in to return a <code>descendingIterator()</code> w...
{ "AcceptedAnswerId": "265547", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T06:36:21.633", "Id": "263446", "Score": "1", "Tags": [ "java", "linked-list", "complexity" ], "Title": "SumList Cracking the coding Interview" }
263446
<p>This is my implementation of the classic &quot;Hangman&quot; word-guessing game.</p> <p>Class LePendu :</p> <pre><code>public class LePendu { // Variable public static int NB_ERREURS_MAX=10; static ArrayList&lt;Character&gt; playerGuess = new ArrayList&lt;Character&gt;(); static ArrayList &lt;Stri...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T13:14:57.820", "Id": "520108", "Score": "0", "body": "thanks for moving it over from stackoverflow! seems to be better place here" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T14:59:12.330", "Id...
[ { "body": "<h2>minor issues: language</h2>\n<p>source code is written in english. I don't speak english and many other don't do as well. that might be one reason why this review has no answers yet.</p>\n<ul>\n<li><code>NB_ERREURS_MAX</code></li>\n<li><code>String penduDessin</code></li>\n<li><code>Random motAle...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T10:15:43.350", "Id": "263448", "Score": "2", "Tags": [ "java", "hangman" ], "Title": "Java hangman game" }
263448
<p>I am building a WPF (Windows Presentation Foundation) application. And I'm trying to use the MVVM (Model–View–ViewModel) design pattern. It's fascinating and rewarding, even though it seems overly complex at times. I am new to programming, and I've only really dabbled in WinForms (Windows Forms) before.</p> <p>I've ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T09:43:24.817", "Id": "520275", "Score": "0", "body": "I haven't received any pointers, please let me know if I am being unclear in the presentation of my project. Any perspective on improvement will still be very much appreciated." ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T11:56:20.917", "Id": "263450", "Score": "4", "Tags": [ "c#", "design-patterns", "wpf", "mvvm", "databinding" ], "Title": "License-holder editing application" }
263450
<p>This is a Python 3 script that statistically analyzes 105,230 words with a total of 913,935 characters, its results will be used for pseudoword generation purposes.</p> <p>You will need <a href="https://drive.google.com/file/d/1kF-sK_RpcpIO3jxOUnJvnlctdaDRLI9o" rel="nofollow noreferrer">this file</a> for it to run.<...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T13:51:52.477", "Id": "263452", "Score": "1", "Tags": [ "python", "performance", "python-3.x", "statistics", "data-mining" ], "Title": "Python 3 script for statistiscal ana...
263452
<p>Second day coding so I'm new to this. I have made this simple calculator but I repeat the code in order to use the previous answer in the next calculation. I've been trying to simplify it but I can't seem to figure it out. Whatever I try breaks the code. Any feed back helps. Here is the code</p> <pre><code># Beginni...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T15:19:16.747", "Id": "520118", "Score": "1", "body": "Welcome and thanks for joining CodeReview! I hope that you get some good feedback; this is a great first question." } ]
[ { "body": "<ul>\n<li>Notice that you have a bunch of repeated code; let's reduce this</li>\n<li>There's no need to pre-initialize your variables in the first five lines of your code</li>\n<li>Your first <code>while</code> loop doesn't deserve to exist; the condition is only evaluated <code>True</code> once</li>...
{ "AcceptedAnswerId": "263458", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T14:43:10.593", "Id": "263456", "Score": "4", "Tags": [ "python", "beginner" ], "Title": "Calculator for basic arithmetic operations" }
263456
<p>I want to replace every <code>div</code> with the class <code>mention</code>. The text should then be parsed and all the parts with <code>@user</code> should be replaced with a link. Here is what I have:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class=...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T16:12:29.510", "Id": "520124", "Score": "0", "body": "There are ways to write this to \"improve performance\". However, is performance really a concern for this snippet? Is it actually slow in the real world use case?" }, { ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T15:35:43.257", "Id": "263459", "Score": "0", "Tags": [ "javascript", "performance", "regex" ], "Title": "Optimize Javascript User Mentioning" }
263459
<p>Let's say I'm implementing a method that calculates the number of hours I'm billing a client. I only work in blocks of <code>K</code> hours:</p> <pre><code>public static int billing(int hours, int k) { return hours / k + (hours % k != 0 ? 1 : 0); } </code></pre> <p>Is it possible to simplify this? I often find m...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T16:31:07.917", "Id": "520128", "Score": "1", "body": "What about `(hours+k-1)/k`?" } ]
[ { "body": "<p>Given the integer operations available on a typical CPU, there's really no way to do it other than to determine whether the remainder is 0 and conditionally round up if it was not.</p>\n<p>However, since you often find yourself using this pattern, write it once. Not limited to &quot;int hours&quo...
{ "AcceptedAnswerId": "263464", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T16:16:09.017", "Id": "263463", "Score": "0", "Tags": [ "java", "algorithm" ], "Title": "Calculate the minimum amount of billing hours" }
263463
<p>I'm not sure if the problem here is how I'm wording the question or going about finding an answer, but I have what I think is a relatively trivial task: getting fact-check claims from the Google Fact Check API, saving them in a database and then using that database to get the counts of fact checked claims &amp; who ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T20:56:08.257", "Id": "520152", "Score": "0", "body": "Why use a database at all, if you're just doing counts? Can you count things streamed from the API?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-2...
[ { "body": "<ul>\n<li>Could benefit from PEP484 type hints, e.g. <code>process_claim(claim: Dict[str, Any], session: Session) -&gt; Claim:</code></li>\n<li>Is <code>strptime(claim[&quot;claimDate&quot;][:-10], '%Y-%m-%d')</code> correct? You're saying that you're taking the whole string from the beginning up to ...
{ "AcceptedAnswerId": "263476", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T17:02:16.690", "Id": "263465", "Score": "1", "Tags": [ "python", "sqlalchemy" ], "Title": "Linking a count to an object in SQLAlchemy" }
263465
<p>This is a simple Java program I made that takes in any number, and when it gets to 0, it returns the quantity of the numbers, the min, max, sum, and average of the numbers. Are there any ways how I can make the code more readable or improve the performance?</p> <pre class="lang-java prettyprint-override"><code>impor...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T15:34:01.733", "Id": "520232", "Score": "0", "body": "That average calculation looks very inaccurate, given the nature of even double-precision floating point." } ]
[ { "body": "<p>First of all, stop thinking about performance. This is not a tight loop, this is not a million numbers you crunch, the <em>only</em> concern you should have is readability and maintainability.</p>\n<p>Now, your code does all at once in a single method. You do input, calculation and output, calcula...
{ "AcceptedAnswerId": "263479", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T20:11:11.607", "Id": "263467", "Score": "1", "Tags": [ "java", "statistics" ], "Title": "Java simple stats program" }
263467
<p>I'm starting to learn React/NextJS and find the way to write conditional CSS very ugly compared to VueJS. I'm curious if someone could look over this code snippet and guide me in the right direction towards a cleaner way of designing my React code.</p> <pre class="lang-html prettyprint-override"><code>&lt;Link key={...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T20:25:49.210", "Id": "520342", "Score": "0", "body": "I rolled back your last edit. After getting an answer you are not allowed to change your code anymore. This is to ensure that answers do not get invalidated and have to hit a mov...
[ { "body": "<p>You could use a conditional <em>className</em> utility. There are <a href=\"https://www.npmjs.com/package/classnames\" rel=\"nofollow noreferrer\">several</a> <a href=\"https://github.com/lukeed/obj-str\" rel=\"nofollow noreferrer\">solutions</a> in the ecosystem, but I would recommend <a href=\"h...
{ "AcceptedAnswerId": "263489", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T21:56:34.940", "Id": "263469", "Score": "2", "Tags": [ "beginner", "css", "react.js", "jsx" ], "Title": "ReactJS link with conditional CSS classes" }
263469
<p>I am currently developing a terminal-based listview control, that uses ncurses for rendering. The main goal for the listview was to be intuitive, performant, and reusable for other projects.</p> <p>An example, is shown below:</p> <p><a href="https://i.stack.imgur.com/keLMM.png" rel="noreferrer"><img src="https://i.s...
[]
[ { "body": "<h1>General Observations</h1>\n<p>The code is solid, basically well written, fairly easy to maintain and the code is reusable. There are a few places where some software engineering principles could help, and while this is C rather than an object oriented language there could be a few places where ob...
{ "AcceptedAnswerId": "263527", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T22:02:17.183", "Id": "263470", "Score": "7", "Tags": [ "c", "ncurses", "console", "listview" ], "Title": "Ncurses listview control" }
263470
<p>I need to know if there is any way I can optimize my code so that it does not use 0.6% of my total memory - which is approx. 22.4MB. This is a really small script that runs for as long as the raspberry pi is ON. 22.4MB for this basic, simple, light code is too much. If less or no optimization is there, then please l...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T23:51:13.083", "Id": "520155", "Score": "2", "body": "I don't think it'll get much lower - at least on my system, `python -c 'import requests, time; time.sleep(600)' &` uses similar amounts of memory even though all it does is impor...
[ { "body": "<ul>\n<li><code>chatId</code> -&gt; <code>chat_id</code> and similar for other members and method names, by PEP8 standard</li>\n<li><code>f&quot;Initializing temperature bot for 123 - &quot;</code> does not need to be an f-string - it has no fields</li>\n<li>if <code>alertResp</code> is not true, you...
{ "AcceptedAnswerId": "263475", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T22:14:08.803", "Id": "263471", "Score": "6", "Tags": [ "python", "memory-optimization", "raspberry-pi", "status-monitoring", "telegram" ], "Title": "Python script whic...
263471
<p>I wrote this simple app for creating a Stock Exchange platform. It is written with a flask framework.</p> <p>My main concerns are regarding the user_page route which feels too long and not DRY enough, But on the other hand, I can't find a pythonic elegant way to clean it. I would really appreciate your comments.</p>...
[]
[ { "body": "<p>The best way to make it more pythonic is to apply the following changes:</p>\n<ol>\n<li><p>Factor out models into a separate module; usually we'd call that <code>models.py</code>. If there are a lot of models you can split them into submodules under the <code>models/</code> package.</p>\n<p>Exampl...
{ "AcceptedAnswerId": "265644", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-25T23:42:39.187", "Id": "263472", "Score": "2", "Tags": [ "python", "python-3.x", "programming-challenge", "flask" ], "Title": "Python app thats simulate simple Stock Exchang...
263472
<p>This is a follow-up of my group of scraper questions starting from <a href="https://codereview.stackexchange.com/q/262772/242934">here</a>.</p> <p>I have thus far, with the help of @Reinderien, written 4 separate &quot;modules&quot; that expose a <code>search</code> function to scrape bibliographic information from ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-07T10:08:51.290", "Id": "520976", "Score": "2", "body": "Hi Sati. Please do not update the code in your question to incorporate feedback from answers, doing so goes against the Question + Answer style of Code Review. Please see [what y...
[ { "body": "<p>I'm going to focus on <code>main.py</code> since the other modules have gotten reviews.</p>\n<ul>\n<li><code>db_dict</code> can be a module-level global constant <code>DB_DICT</code></li>\n<li>the convenient interface is to replace your <code>db</code> argument with <code>*args</code> taking one o...
{ "AcceptedAnswerId": "263820", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T01:09:51.073", "Id": "263474", "Score": "1", "Tags": [ "python", "web-scraping", "modules" ], "Title": "Organizing things together to form a minimum viable Scraper App" }
263474
<p>This is my first post. I'm switching from Python to Java and I've been practicing on <code>HackerRank</code> for some time. Today I solved this problem in which you have to count the pairs of occurrences of the numbers in the ArrayList, symbolizing socks, and you have to count the pairs.</p> <p>Can this be optimized...
[]
[ { "body": "<p>In your for-loop, you basically mimic <code>Map.computeIfAbsent</code>. For a given int <code>n</code>, you can use</p>\n<pre><code>map.computeIfAbsent(n, ignore -&gt; 0);\n</code></pre>\n<p>to return 0 when the key is not present, and thus</p>\n<pre><code>map.put(n, map.computeIfAbsent(n, ignore ...
{ "AcceptedAnswerId": "263495", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T03:13:27.967", "Id": "263477", "Score": "4", "Tags": [ "java", "performance", "beginner" ], "Title": "HackerRank Sales by Match" }
263477
<p>I have a table containing two versions of results for some predictors, one by human labeling and the other by machine predicting, and I want to calculate some metrics.</p> <pre><code>CREATE TABLE log_table ( `id` VARCHAR(5), `version` VARCHAR(15), `result` FlOAT ); INSERT INTO log_table (`id`, `version`, `r...
[]
[ { "body": "<p>Fundamentally you just need to rethink how your aggregation is done. The RDBMS you use - MySQL - <a href=\"https://modern-sql.com/feature/filter\" rel=\"nofollow noreferrer\">is broken and does not support</a> standard <a href=\"https://www.postgresql.org/docs/13/sql-expressions.html#SYNTAX-AGGREG...
{ "AcceptedAnswerId": "263485", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T09:29:01.060", "Id": "263481", "Score": "1", "Tags": [ "sql", "mysql" ], "Title": "SQL for precision and recall?" }
263481
<p>I'm learning <code>Vue</code> and I would like an opinion to improve the form validation that I have implemented. This is my component:</p> <pre><code>&lt;template&gt; &lt;section class=&quot;p-0 d-flex align-items-center&quot;&gt; &lt;div class=&quot;container-fluid&quot;&gt; &lt;div class=&quot...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T09:34:14.770", "Id": "263482", "Score": "1", "Tags": [ "vue.js" ], "Title": "Vue form validation" }
263482
<p>I'm trying to replicate <code>std::array</code> but with modifications that I should put the private data member to the public so the class template <code>fixed_array</code> will be a structural type that will be qualified as a non-type template parameter.</p> <p>My goal here is to use the string literals and brace-...
[]
[ { "body": "<p>Mainly this is pretty nice :)</p>\n<hr />\n<pre><code>constexpr fixed_array(const std::initializer_list&lt;value_type&gt;&amp; args) noexcept {\n std::copy_n(args.begin(), N, data);\n}\n</code></pre>\n<p>We definitely need to check that the initializer_list is the correct size, and throw if it ...
{ "AcceptedAnswerId": "263507", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T13:24:15.437", "Id": "263486", "Score": "2", "Tags": [ "c++", "template-meta-programming", "c++20" ], "Title": "Creating a structural type array wrapper to be qualified as non...
263486
<p>I want to compare 2 images using <code>numpy</code>. This is what I have got so far. One of the outputs should be a white image with black pixels where pixels are different.</p> <p>I am sure it's possible to make it more efficient by better use of numpy, e.g. the <code>for</code> loop can be avoided. Or maybe there ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T15:18:31.050", "Id": "520170", "Score": "0", "body": "@Reinderien done!" } ]
[ { "body": "<p>First, this of course depends on your definition of different. I believe right now that your comparison is far too strict, given the defaults for <code>isclose</code>. I did a trivial modification of a .jpg, and with one decode/encode pass it still produced 6% of pixels with an RGB distance of mor...
{ "AcceptedAnswerId": "263497", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T14:30:43.343", "Id": "263487", "Score": "2", "Tags": [ "python", "numpy" ], "Title": "Efficient Comparison Of Two Images Using Numpy" }
263487
<p>I tried <a href="https://stackoverflow.com/questions/48446708/securing-spring-boot-api-with-api-key-and-secret">https://stackoverflow.com/questions/48446708/securing-spring-boot-api-with-api-key-and-secret</a>, but that didn't work for me (filter did nothing). Since I couldn't find any useful tutorial with API keys...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T06:29:33.693", "Id": "520206", "Score": "1", "body": "HI @TristanK. couldn't you just do `httpRequest.getHeaders(principalRequestHeader)` rather than looping over all of them? - see https://docs.oracle.com/javaee/6/api/javax/servlet...
[]
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T15:21:47.827", "Id": "263488", "Score": "0", "Tags": [ "java", "security", "spring", "spring-mvc" ], "Title": "Spring Boot API Key Filter" }
263488
<p>I'm trying to write a function that tries to read a config and if fails, creates a new one and writes to the file &quot;settings.ini&quot;. This feels really chunky and not particularly concise. Is this the supposed way of reading a configparser file?</p> <pre><code>from configparser import ConfigParser def getSetti...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T19:07:13.963", "Id": "520186", "Score": "0", "body": "I think admins will remove the question; it doesn't seem belong here. Meanwhile this is your app and your decision, but: 1) it will be very strange to have overwritten config aft...
[]
{ "AcceptedAnswerId": null, "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T18:36:33.147", "Id": "263493", "Score": "2", "Tags": [ "python" ], "Title": "Should i use a try catch statement for reading a configparser file when loading a setting?" }
263493
<p>In my application, I only show users their own data. For that, I need to know in the backend, which user is requesting data. I use the username for that and therefore, I need to send the username as part of the GET request.</p> <p>The method in question, located in MVC-controller:</p> <pre><code>public async Task&lt...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T08:48:33.850", "Id": "520208", "Score": "1", "body": "Welcome to Code Review! Please [edit] your question so that the title describes the *purpose* of the code, rather than its *mechanism*. We really need to understand the motivati...
[ { "body": "<p>Few tips:</p>\n<ul>\n<li>respect <code>IDisposable</code> objects, apply <code>using</code> where necessary.</li>\n<li>if you encapsulating HTTP API logic into a helper class, do it completely</li>\n<li>exposing <code>HttpClient</code> outside isn't a good idea, what if you'll decide to change <co...
{ "AcceptedAnswerId": "263509", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-26T21:07:42.000", "Id": "263498", "Score": "1", "Tags": [ "c#", "mvc", "asp.net-core-webapi", ".net-5" ], "Title": "Best practices in regards to pass and deserialize data, wh...
263498
<pre><code>class Person { constructor(firstName, lastName, email) { this.firstName = firstName; this.lastName = lastName; this.email = email; } returnObject() { return { &quot;firstName&quot;: this.firstName, &quot;lastName&quot;: this.lastName, &quot;email&quot;: this.emai...
[]
[ { "body": "<p>I'd get rid of the <code>json</code> function. Having it means you have to remember to use <code>somePerson.json()</code> instead of the usual <code>JSON.stringify(somePerson)</code>. If you need to control the JSON output to make sure your API stays the same even as your class changes, you can do...
{ "AcceptedAnswerId": "263503", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T04:06:04.823", "Id": "263502", "Score": "1", "Tags": [ "node.js" ], "Title": "Is this node.js class returning a json" }
263502
<p><strong>TL;DR</strong> How to better avoid some of the colors in the gradient looking like brighter/darker lines and make them blend in with neighboring colors. Not too concerned with performance/color accuracy but don't like how my algorithm muddies up colors at higher blend settings.</p> <p>Working example: <a hre...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T12:12:02.250", "Id": "520224", "Score": "0", "body": "What programming language are you using? Where is the definition for vec3?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T18:35:48.767", "Id"...
[]
{ "AcceptedAnswerId": null, "CommentCount": "8", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T08:48:59.743", "Id": "263506", "Score": "0", "Tags": [ "algorithm", "opengl", "glsl", "color" ], "Title": "\"Smoothing\" colors in mutliple-color gradient in fragment shader" ...
263506
<p>I'd like to plot an animation of <a href="https://en.wikipedia.org/wiki/Lissajous_curve" rel="nofollow noreferrer">Lissajous curves</a> using Python and matplotlib's <code>animate</code> library. I really do not have a lot of experience with Python, so rather than performance increasements, I'm looking for best prac...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T11:41:36.600", "Id": "263510", "Score": "4", "Tags": [ "python", "animation", "matplotlib", "jupyter" ], "Title": "Animating Lissajous curves with Python and matplotlib's anim...
263510
<p>Basically I made this completely useless program that generates triangles inside triangles. Its not perfect yet but my question is about the structure. I am generally happy with it but I want to know if it could have been better. There are six files and here they are.</p> <p>main.cpp</p> <pre><code>#define OLC_PGE_...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T12:00:25.637", "Id": "520286", "Score": "0", "body": "It would be nice if you would provide a ZIP file of your source code." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T13:57:27.117", "Id": "52...
[]
{ "AcceptedAnswerId": null, "CommentCount": "10", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T13:20:57.847", "Id": "263511", "Score": "2", "Tags": [ "c++", "computational-geometry", "graphics" ], "Title": "Structuring a project that generates triangles inside triangles" }
263511
<p>I am building a little helper for the card game Bridge. The aim is to generate a &quot;hand&quot; of 13 randomly-dealt cards, and then to run various calculations on the hand to help a player with the &quot;bidding&quot; phase of the game. (<em>I'm hoping knowledge of Bridge is not required for this code review!</em...
[]
[ { "body": "<h2>Abstractions</h2>\n<p>When coding we abstract the data we manipulate in such a way to make the code easy to write and efficient to execute. Abstracted data only contains what is relevant.</p>\n<p>Very often coders will forget the abstraction and focus on the irrelevant details a trap you have fal...
{ "AcceptedAnswerId": "263519", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T14:07:00.530", "Id": "263513", "Score": "4", "Tags": [ "javascript", "playing-cards" ], "Title": "Deal and evaluate a Bridge hand" }
263513
<p>I've written a C# program to generate a random maze, and then draw that maze in the Console mode using box-drawing characters, e.g. ─ │ ┌ ┐ ┬ ┼ etc. It works fine, as below, but I'm not convinced that the code used is remotely efficient, or that it couldn't be done better.</p> <p><a href="https://i.stack.imgur.com/3...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T07:13:24.347", "Id": "520268", "Score": "1", "body": "You might be interested in looking at this: [Visualising Algorithms, maze generation](https://bost.ocks.org/mike/algorithms/#maze-generation)" }, { "ContentLicense": "CC ...
[ { "body": "<p>There are different possible approaches to assign the wall characters. One uses the new C# 8.0 switch expressions together with the tuple pattern.</p>\n<pre class=\"lang-cs prettyprint-override\"><code>char corner = (curNorth, curWest, nextEast, nextSouth) switch {\n (true, true, true, true) =...
{ "AcceptedAnswerId": null, "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T15:46:42.820", "Id": "263517", "Score": "4", "Tags": [ "c#", "performance", "array", "console", "ascii-art" ], "Title": "More efficient way to create an ASCII maze using b...
263517
<h3>Background</h3> <p>This question is inspired by the question: <a href="https://codereview.stackexchange.com/q/263444/61495">Killing a hydra</a>, and my response therein. I will restate the problem at hand in full so that this question is fully self contained</p> <blockquote> <p>You can only kill off a given number ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T20:14:08.337", "Id": "520246", "Score": "1", "body": "Please always tag Python questions with [tag:python] so the correct syntax highlighter is used." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T07...
[ { "body": "<p>This was an interesting puzzle and your question was framed very well. I have a\nfew code-review style comments. Those are followed by some discussion of, and\ncorresponding code for, a different algorithmic approach -- one that seems\neasier to follow, at least to my eye.</p>\n<p><strong>The Hydr...
{ "AcceptedAnswerId": "263621", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T18:25:18.140", "Id": "263522", "Score": "3", "Tags": [ "python", "python-3.x", "programming-challenge", "recursion", "dynamic-programming" ], "Title": "Killing a Hydra...
263522
<p>For context, I wrote a function, <code>get_servers</code>, for the game <a href="https://bitburner.readthedocs.io/en/latest/" rel="nofollow noreferrer">Bitburner</a> which is usually played by writing JavaScript code. Instead, I used PureScript to write the function which is an implementation of something like the b...
[]
[ { "body": "<p><strong>First</strong>, on rightward drift: you don't have to have every next function nested under the previous one, especially since none of them actually need access to the enclosing function's parameters. You can have everything bound under the same <code>where</code>. Except that <code>get_ne...
{ "AcceptedAnswerId": "263590", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T20:08:34.920", "Id": "263523", "Score": "1", "Tags": [ "beginner", "algorithm", "graph", "breadth-first-search", "purescript" ], "Title": "PureScript breadth-first sea...
263523
<p>Basically, I'm trying to create a generic way to check if two shapes are colliding.</p> <p>I think this is kind of a &quot;double-dispatch&quot; problem, but I'm unsure if there is a better way to solve it in Typescript / Javascript. This is the best I could come up with. Just assume the static helper functions are ...
[]
[ { "body": "<h2>Double dispatch</h2>\n<p>You can not avoid double dispatch as the collision type is unknown. The only way to avoid the double dispatch is to duplicate the collision tests for each object.</p>\n<p>Eg line check line circle and circle would check circle line</p>\n<pre><code>collidesWith(shape) { /...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T20:43:24.640", "Id": "263524", "Score": "1", "Tags": [ "javascript", "performance", "typescript", "casting" ], "Title": "Checking if two shapes collide in TypeScript (double d...
263524
<pre><code>import axios from &quot;axios&quot;; import { useEffect, useState } from &quot;react&quot;; import &quot;./styles.css&quot;; export default function App() { const [count, setCount] = useState(1); const [titles, setTitles] = useState([]); useEffect(() =&gt; { async function fetchData() { cons...
[]
[ { "body": "<p>I will first suggest some miscellaneous changes to the code and then answer your questions.</p>\n<h2>A better <code>count</code> handling</h2>\n<p>I think that naming the state <code>count</code> is a bit misleading because it is used as an offset to fetch the todos. This may count as a nit, but w...
{ "AcceptedAnswerId": "263530", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T20:58:14.757", "Id": "263525", "Score": "1", "Tags": [ "react.js", "api", "jsx" ], "Title": "React component with axios calls" }
263525
<p>My hobby is Unix-like operating systems.</p> <p>Recently I began writing my own sel4-based Posix compliant OS. Here's the code for internal signal handling functions which presents a kind of backend to help implement functions such as <code>do_kill</code> or <code>do_sigsuspend</code>.</p> <p>I would like to know w...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T22:22:47.863", "Id": "520253", "Score": "0", "body": "no, my code is working how it must. me simply interesting how i can improve alghroritm" } ]
[ { "body": "<p>What are the magic numbers 256 scattered all over the place? If they all mean the same thing (number of supported distinct signals?), then name a constant. If they have more than one meaning, then there's even more reason to use well-named constants.</p>\n<p>I don't like these:</p>\n<blockquote>...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T21:04:44.633", "Id": "263526", "Score": "3", "Tags": [ "c++", "posix", "kernel", "signal-handling" ], "Title": "Posix signal implementation" }
263526
<p>I have been working on this project for a little bit and it's my first major python program. It downloads information about current and upcoming weather warnings for Ireland and displays them with tkinter. Would be grateful of suggestions or critique!</p> <p><a href="https://github.com/Sn4u/met-eireann-status/tree/m...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T22:17:51.083", "Id": "520251", "Score": "1", "body": "Welcome to Codereview, and great first question!" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T22:50:03.543", "Id": "520254", "Score": "...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T22:15:22.847", "Id": "263528", "Score": "2", "Tags": [ "python", "tkinter", "gui" ], "Title": "Irish Weather Warnings App in Tkinter" }
263528
<p>I have a class that is importing a CSV file into a Pandas DataFrame. However, this CSV has a multiline header that changes length seemingly at random. Sometimes it is 27 lines, sometimes 31, sometimes something else. It is just dirty data in so many other ways as well, look at the header separator.</p> <p>As a resul...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T00:04:03.097", "Id": "520255", "Score": "1", "body": "I think this would benefit from some sample data. Ideally, this would be done not in an attached file but just formatted as code, with as few headers and data as possible while s...
[ { "body": "<p>Per PEP 8, never use leading and trailing double underscores in names of your own functions or methods. They are for python's magic methods. If you want to indicate a method is protected (not the public API, but useable by subclasses), use a single leading underscore. To indicate it is private (no...
{ "AcceptedAnswerId": null, "CommentCount": "5", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-27T23:40:31.237", "Id": "263529", "Score": "0", "Tags": [ "python", "pandas", "dynamic-loading", "data-importer" ], "Title": "Multiple CSV Imports with Pandas" }
263529
<p>I'm a beginner in programming and I'm figuring out what is the best approach for my mini e commerce site project.</p> <p>My current approach is</p> <pre class="lang-html prettyprint-override"><code>{% for i in item %} &lt;!-- where item = database fetchall --&gt; &lt;h3&gt; {{i[0]}} &lt;/h3&gt; &lt;!-- product name...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T03:19:13.280", "Id": "520260", "Score": "0", "body": "I currently have it deployed on winmarimanzano.pythonanywhere.com but wondering it is due to my free subscription / internet connection or the code itself that is causing for it ...
[]
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T01:40:42.633", "Id": "263531", "Score": "1", "Tags": [ "python", "javascript", "html5", "flask" ], "Title": "Flask Session + Jinja OR Javascript + Flask" }
263531
<p>This is a problem-solving code for <a href="https://leetcode.com/problems/rank-transform-of-a-matrix/" rel="nofollow noreferrer">LeetCode 1632</a>.</p> <blockquote> <p>Given an <span class="math-container">\$m \times n\$</span> <code>matrix</code>, return a new matrix <code>answer</code> where <code>answer[row][col]...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T05:13:57.580", "Id": "520261", "Score": "1", "body": "Can you add a description of the purpose of the code?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T05:16:22.180", "Id": "520262", "Scor...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T02:25:07.217", "Id": "263532", "Score": "4", "Tags": [ "programming-challenge", "matrix", "rust" ], "Title": "LeetCode 1632: Rank Transform of a Matrix in Rust" }
263532
<p>The following command series is used to gather every bit of valuable information from <a href="https://etip.exodus-privacy.eu.org/trackers/all" rel="nofollow noreferrer">Exodus trackers</a>. The ultimate goal would be to get this all into one <code>jq</code> statement, and if that's not possible then to just simplif...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T06:27:06.247", "Id": "520264", "Score": "1", "body": "Would you mind adding example inputs and outputs to the question?" }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T13:59:03.087", "Id": "520294...
[ { "body": "<p>Since you said the order of the outputs doesn't really matter, the first <code>reverse</code> in the <code>.code_signature</code> path seems useless - as far as I can tell, all it does is change the order of certain outputs (the second <code>reverse</code> on the other hand is useful).</p>\n<p>In ...
{ "AcceptedAnswerId": "263556", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T03:29:00.517", "Id": "263533", "Score": "4", "Tags": [ "json", "bash", "linux" ], "Title": "Extracting domains and IPs from Exodus trackers JSON report" }
263533
<p>This is my function that uses recursion to recursively delete a directory. I like my way of skipping entries <code>.</code> and <code>..</code>.</p> <p>But should I be casting the name lengths to <code>unsigned int</code> because I am quite sure there will not be file paths longer than 4 gigacharacters? Or is storin...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T17:02:52.867", "Id": "520324", "Score": "1", "body": "Note that `d_type` is an optional optimization, and can be DT_UNKNOWN. See [Checking if a dir. entry returned by readdir is a directory, link or file. dent->d\\_type isn't showi...
[ { "body": "<p>We're missing the necessary headers for <code>struct dirent</code> and the Standard library string functions (<code>strlen</code>, <code>memcpy</code> etc).</p>\n<p>It's probably worth providing an explanatory comment that tells the user what the return values mean. It appears that it returns 0 o...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T05:58:01.913", "Id": "263536", "Score": "7", "Tags": [ "c", "recursion", "file-system" ], "Title": "C delete files and directories, recursively if directory" }
263536
<p>Here is another one of my simple beginner projects I did in my free time in under 30 minutes, a Rock, Paper, Scissors game in Python against a Computer (random module). As usual, I would like to know if there are any improvements/suggestions/criticism/feedback that you guys have about my code. Thanks in advance.</p>...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T01:05:13.733", "Id": "520449", "Score": "0", "body": "I magically get pinged when such questions arise... I wonder why. ;)" } ]
[ { "body": "<h1>Cleanup</h1>\n<p>For cleanliness:</p>\n<pre><code>if(computer == playerInt):\n result = 0\n\nelif(computer == 0 and playerInt == 1):\n result = 1\n\nelif(computer == 1 and playerInt == 2):\n result = 1\n\nelif(computer == 2 and playerInt == 0):\n result = 1\n\nelif(computer == 0 and p...
{ "AcceptedAnswerId": "263550", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T07:15:00.077", "Id": "263537", "Score": "15", "Tags": [ "python", "rock-paper-scissors" ], "Title": "My Rock, Paper, Scissors Game in Python" }
263537
<p>I've written a simple text-based (can be run in terminal) snake game in python. This is a personal project and also one of my very first projects in python. I appreciate any advice or suggestion that make my code more efficient and professional.</p> <p><strong>main.py</strong></p> <pre class="lang-py prettyprint-ove...
[]
[ { "body": "<p>First off, nice game! It plays pretty smoothly. The code looks decent as-is, which is why I'm going more in depth--high level, no improvements are really needed.</p>\n<p>I'll go through by file, since it's split up.</p>\n<h2>General comments</h2>\n<ul>\n<li>Read <a href=\"https://www.python.org/de...
{ "AcceptedAnswerId": "269286", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T09:11:20.217", "Id": "263541", "Score": "4", "Tags": [ "python", "snake-game" ], "Title": "A simple text based snake game in python" }
263541
<p>I have been working on a small script which scrapes a webpage and returns the information that has been scraped such as name, iamge, price etc etc.. However I am abit concern regarding my exceptions where I do not believe I am covering it correct or could improve it as well.</p> <p>For now I have done something like...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T11:22:17.030", "Id": "263545", "Score": "0", "Tags": [ "python-3.x" ], "Title": "Scrape website with exceptions" }
263545
<p>Playing on leetcode coding problem: &quot;Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.&quot;</p> <p>I realized that my understanding of Python was not so good. I always thought that: since list are mutable object they are kind of passed by reference; so i al...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T12:59:26.410", "Id": "520288", "Score": "0", "body": "We can't review your friend's code here, nor do we explain how code works - you're expected to understand that if you wrote it! Additionally, your title should summarise the _pr...
[ { "body": "<p>In the future, for purposes for code review, please include an example case to run. This makes it easier for reviewers.</p>\n<pre><code>if __name__ == '__main__':\n all_solutions = Solution().generate_parentheses(4)\n print(all_solutions)\n</code></pre>\n<h2>Style</h2>\n<ul>\n<li>Your variab...
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T11:50:58.157", "Id": "263547", "Score": "3", "Tags": [ "python", "python-3.x", "programming-challenge", "balanced-delimiters" ], "Title": "Generate valid combinations of paren...
263547
<p>I just want your opinion about that code! :)</p> <pre><code>import random class Error(Exception): def __init__(self, error=None): self.error = error def __str__(self): return str(self.error) class HashTable(object): def __init__(self): self.length = 20 self.keys = [] ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T14:40:50.200", "Id": "520398", "Score": "1", "body": "I'm going to assume that you're not using a built-in dictionary for learning purposes etc., but that would greatly simplify this code." } ]
[ { "body": "<p>My opinion is that you should test better, before asking for code review.</p>\n<pre><code>line = &quot; #Wartosc jest dodawana do listy pod hashowanym indeksem&quot;\nfor word in line.split():\n content.append(word)\nfor c in content:\n L[c] = c\nprint(L[&quot;jest&quot;])\n</code></pre>\n<p...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T13:39:10.687", "Id": "263552", "Score": "1", "Tags": [ "python", "reinventing-the-wheel", "hash-map" ], "Title": "Hashing Table in Python" }
263552
<p>I have this function:</p> <pre class="lang-py prettyprint-override"><code>import re def check_and_clean_sequence(sequence, alphabet): &quot;&quot;&quot; Function to check and clean up all ambiguous bases in a sequence. Ambigous bases are bases that are not in the sequence alphabet, ie. 'ACGT' for DN...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T17:23:38.417", "Id": "520327", "Score": "6", "body": "Please do not update the code in your question to incorporate feedback from answers, doing so goes against the Question + Answer style of Code Review. This is not a forum where y...
[ { "body": "<p>Perhaps there aren't enough test cases here, because I don't see why you can't just use:</p>\n<pre><code>pattern = re.compile(r&quot;[^ACGT]&quot;)\nprint(pattern.sub(&quot;&quot;, toy_sequence))\n</code></pre>\n<p>Which says replace all characters that are not in <code>ACGT</code> with blanks. Th...
{ "AcceptedAnswerId": "263589", "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T14:30:27.030", "Id": "263553", "Score": "8", "Tags": [ "python", "python-3.x", "regex", "bioinformatics" ], "Title": "Filter out ambiguous bases from a DNA sequence" }
263553
<p>I created a fairly simple hangman program as a little side project. Could you please tell me of any improvements/suggestions/criticism/feedback that you have about my code? Thank you in advance.</p> <pre><code>import tkinter as tk import turtle import string from functools import partial from draw_hangman import dra...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T18:10:40.027", "Id": "263560", "Score": "1", "Tags": [ "python-3.x", "tkinter", "hangman" ], "Title": "Hangman program (python)" }
263560
<p>I am inserting data from a dict type object into three different tables in the SQL database. I am using Sqlalchemy as my ORM. My code is working but I think it is not very readable, is it any way to make it more readable or maybe simpler? I am using a lot of <code>try except</code> because I don't want my code to fa...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T07:23:13.670", "Id": "520365", "Score": "0", "body": "@BCdotWEB i have changed the title. Thanks" } ]
[ { "body": "<p>If you are concerned about <strong>data integrity,</strong> that's what <strong>transactions</strong> are for. I don't really see the point of nested try/catch blocks. A single block for the whole procedure would be sufficient.</p>\n<p>So, at the start of your try block, you start an explicit tran...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T20:13:23.530", "Id": "263563", "Score": "1", "Tags": [ "python", "python-3.x", "sqlalchemy" ], "Title": "Inserting Data to three linked table with SQLAlchemy" }
263563
<p>For a Metal application, I would like to create and initalize texture object globally so it will not have to be optional, and will already be ready to use once <code>viewDidLoad</code> is called. To do this, I need a <code>MTLTextureDescriptor</code> with the correct values <em>inline</em>. It has to be inline becau...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-09-12T17:07:40.153", "Id": "528286", "Score": "0", "body": "Please forgive the unrelated observation, but in Swift, variable/property names always start with a lowercase letter (e.g. `terrainTexture` rather than `TerrainTexture`). Upperca...
[ { "body": "<p>You said:</p>\n<blockquote>\n<p>It has to be inline because I do not want to create a global descriptor that will only be used once</p>\n</blockquote>\n<p>The provided pattern, where you call <code>makeTexture</code> with a parameter that is a closure is a bit hard to read. Instead, you can initia...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-28T22:10:40.673", "Id": "263566", "Score": "1", "Tags": [ "swift", "classes" ], "Title": "Initialize Swift class or struct values inline" }
263566
<p>I'm currently trying to implement a c shim which sits between the open function from the c standard library and a program.</p> <p>the shim should transparently write all file paths being opened to a log within a directory defined by the environment variable <code>IO_SHIM_PREFIX</code></p> <p>I have this working rela...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T00:49:41.230", "Id": "520350", "Score": "4", "body": "I think the error is saying that you should make your `open` also take a variable argument list. Theoretically, you could just ignore it any extra args, but actually you should ...
[ { "body": "<blockquote>\n<pre><code> char* log_filepath = (char*) malloc(sizeof(char) * path_len);\n</code></pre>\n</blockquote>\n<p><code>malloc()</code> returns a <code>void*</code>, which in C converts to any object-pointer type (unlike in C++, if you're used to that). So the cast is unnecessary (it's sl...
{ "AcceptedAnswerId": "263575", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T00:41:36.140", "Id": "263569", "Score": "0", "Tags": [ "c", "linux" ], "Title": "shimming the c open function on linux and logging its usage" }
263569
<p>It's taking 2.4 MB of memory and 20 ms. It's my solution for Two Sum problem on LeetCode. How can I make it better using closures and other stuff? Kindly review the code.</p> <pre class="lang-rust prettyprint-override"><code>use std::convert::TryInto; impl Solution { pub fn two_sum(nums: Vec&lt;i32&gt;, target:...
[]
[ { "body": "<h3>Proper name and description</h3>\n<p>Rename the question and give it proper description and tags according to <a href=\"https://codereview.stackexchange.com/help/how-to-ask\">https://codereview.stackexchange.com/help/how-to-ask</a></p>\n<h3>Indent the code</h3>\n<p>Unindented code looks ugly. Mor...
{ "AcceptedAnswerId": "263574", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T06:23:53.277", "Id": "263572", "Score": "2", "Tags": [ "programming-challenge", "rust", "k-sum" ], "Title": "Solution to LeetCode Two Sum problem in Rust" }
263572
<p>Consider the infinite sequence <code>u</code>, where <code>u</code> is defined as follows:</p> <ul> <li>The number <code>u(0) = 1</code> is the first one in <code>u</code>.</li> <li>For every <code>x</code> in <code>u</code>, then <code>y = 2 * x + 1</code> and <code>z = 3 * x + 1</code> are also in <code>u</code>.<...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T06:52:29.067", "Id": "520360", "Score": "5", "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": "<h1>Profiling</h1>\n<p>The first thing you should do when trying to optimize your code is profile. Don't guess what the problem is, Python makes profiling easy and you should use that to your advantage.</p>\n<p><a href=\"https://stackoverflow.com/a/582337/11659881\">This answer</a> will help you get ...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T06:41:34.227", "Id": "263573", "Score": "1", "Tags": [ "python", "python-3.x", "time-limit-exceeded" ], "Title": "Compute members of the infinite series generated by 2n+1 and 3n+1...
263573
<h2>Code</h2> <pre class="lang-cs prettyprint-override"><code>List&lt;Element&gt; elements = GetElementsList(); ISet&lt;string&gt; usedInnerElements = new HashSet&lt;string&gt;(); foreach (Element element in elements) { foreach (InnerElement innerElement in element.InnerCollection.InnerElements) { used...
[]
[ { "body": "<p>If we can assume that none of the values can be <code>null</code> then the simplest solution I can think of:</p>\n<pre><code>ISet&lt;string&gt; usedInnerElements = elements\n .SelectMany(coll =&gt; coll.InnerCollection.InnerElements\n .Select(elem =&gt; elem.SomeValue))\n .Distinct()\...
{ "AcceptedAnswerId": "263580", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T10:16:07.260", "Id": "263579", "Score": "1", "Tags": [ "c#", "linq" ], "Title": "Is there a nice way to add unique items from inner collections using LINQ method syntax" }
263579
<p>I'm trying to write a <code>JSON.stringify</code> wrapper that never throws exceptions, and also <a href="https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify">includes properties like those on Error</a>.</p> <p>I think this means it has to:</p> <ul> <li>handle c...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T11:49:53.607", "Id": "263581", "Score": "2", "Tags": [ "javascript" ], "Title": "Resilient JSON.stringify that never throws" }
263581
<p>This code solves <a href="https://projecteuler.net/problem=35" rel="nofollow noreferrer">Project Euler problem 35</a>:</p> <blockquote> <p>The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11...
[]
[ { "body": "<h3>Don't check if there are even digits</h3>\n<p>Add</p>\n<pre><code>if n&lt;10:\n return [n]\nif any(even in str(n) for even in &quot;02468&quot;):\n return []\n</code></pre>\n<p>into <code>rotations</code>, because every number (except for 2) with the last even digit will not be prime, there...
{ "AcceptedAnswerId": "263584", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T12:21:38.283", "Id": "263583", "Score": "1", "Tags": [ "python", "performance", "python-3.x", "programming-challenge", "primes" ], "Title": "Count prime numbers whose ...
263583
<p>I have written an application for lawyers' offices. There is an API to fetch info about court cases. I have implemented API calls for front end when user enters particular case; one tab is filled with info from this API about this case's state in court.</p> <p>This code is run from a daily cron job; for all the case...
[]
[ { "body": "<p>Tip: reusing the curl handle keeps the connection to the server open. Since you are marking repeated request against the same host, this should speed up things. Use <code>$ch = curl_init();</code> at the start of your code, out of the <code>ePredmeti</code> function in order to reuse your curl ins...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T14:10:13.587", "Id": "263586", "Score": "1", "Tags": [ "performance", "php", "api", "curl" ], "Title": "Automatic notification system about changes to court cases" }
263586
<p>Hello I have this function that takes array of objects and takes a specific value from the object and creates array of strings that can make mapped to dropdown selector.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snipp...
[]
[ { "body": "<p>What I want is a Set (a collection of unique elements).</p>\n<pre><code>const dataFilterArray = (data, str) =&gt; {\n let s = new Set();\n data.forEach(itm =&gt; {\n (itm[str] || '').split(' ').forEach(v =&gt; { \n if(v.length !== 0) s.add(v); \n });\n });\n return ['Select All'].co...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T15:53:50.193", "Id": "263588", "Score": "3", "Tags": [ "javascript", "performance", "algorithm", "node.js" ], "Title": "Javascript best way to filter out empty values and simp...
263588
<p>I have created Splash Screen Library in jQuery, The Splash Screen will display until the website completed loading all the images. I just wanted to review if there is any improvements for the code.</p> <p>Here is the jQuery Code:</p> <pre class="lang-js prettyprint-override"><code>(function (window, document, undefi...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T16:55:25.287", "Id": "263591", "Score": "2", "Tags": [ "javascript", "jquery" ], "Title": "Splash Screen Library in jQuery" }
263591
<p>EDIT: Changed title, few mistakes in code were resolved (now working properly)</p> <p>The GUI I am trying to make will be a simple QTabWidget, leading a user straightforwardly towards the end tab by tab.</p> <p>For now, I have three *.py files - main.py, tab1.py, tab2.py. In main.py is the main window of the app and...
[]
[ { "body": "<p>Basically your code works.</p>\n<p>To write the selected path, you use the <code>QLineEdit</code> widget of the <code>Tab_1</code> class.\nYou don't show the <code>path_line</code> widget itself anywhere, but use the <code>textChanged</code> signal.</p>\n<p>It is not clear why there is a <code>pat...
{ "AcceptedAnswerId": "263707", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T18:03:13.300", "Id": "263594", "Score": "1", "Tags": [ "python", "gui", "pyqt" ], "Title": "Proper way to pass an infromation/variable across QTabWidgets?" }
263594
<p>Is the following a proper way to write a class using Keras and TensorFlow to train a neural network?</p> <pre><code>from tensorflow import keras from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt from livelossplot import PlotLossesKeras import numpy class NeuralNet: ...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T21:14:53.690", "Id": "263602", "Score": "0", "Tags": [ "python", "neural-network", "tensorflow", "keras" ], "Title": "Neural Network class in python" }
263602
<p>I have implemented a correct version of DFS (with comments explaining the implementation):</p> <pre><code>from lark import Lark, tree, Tree, Token def dfs(root_node : Tree, f) -&gt; Tree: &quot;&quot;&quot; To do DFS we need to implement a stack. In other words we need to go down the depth until the depth ...
[]
[ { "body": "<blockquote>\n<p>Doing that blindly however for trees leads to wrong printing</p>\n</blockquote>\n<p>No surprise here. In the initial version the deque functions like a stack, so when you change it to the honest-to-goodness stack nothing changes: you still need to push children nodes in the reverse o...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T22:22:07.280", "Id": "263604", "Score": "1", "Tags": [ "python", "tree", "depth-first-search" ], "Title": "How does one write DFS in python with a Deque without reversed for Trees...
263604
<p>I recently wrote a login function in my express application that does the following:</p> <ol> <li>Verifies the user's email and password are correct</li> <li>Generates a JWT Access Token with a short expiry date, and then sends it back to the user</li> <li>Generates a JWT Refresh Token with a long expiry date, and t...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T23:45:17.333", "Id": "520443", "Score": "0", "body": "Why use `await` in `await bcrypt.compareSync(...)`? It's synchronous, right? It directly returns the value, not a promise, right?" }, { "ContentLicense": "CC BY-SA 4.0"...
[ { "body": "<p>I think your middleware is fine. The problem is that you do everything in the controller. The controller should just call the login function from your business layer.</p>\n<p>You had to comment the code to explain it. Treat this as a sign that the function is doing too much. You will see, that I h...
{ "AcceptedAnswerId": "263673", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-29T23:42:35.263", "Id": "263608", "Score": "1", "Tags": [ "javascript", "authentication", "express.js", "jwt" ], "Title": "Making my login function more readable and maintain...
263608
<p>This is my solution to <a href="https://leetcode.com/problems/course-schedule-ii/" rel="nofollow noreferrer">Leetcode #210, Course Schedule II</a>.</p> <blockquote> <p>There are a total of <code>numCourses</code> courses you have to take, labeled from <code>0</code> to <code>numCourses - 1</code>. You are given an a...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T04:40:01.083", "Id": "520452", "Score": "2", "body": "Getting rid of `nonlocal` seems trivial. Let `topological_sort` return a boolean." } ]
[ { "body": "<p><strong>Clear algorithm and naming</strong>. You've done a good job with the algorithm and\nusing clear naming. I had no trouble reading and understanding the code.</p>\n<p><strong>Declarative constants are good</strong>. Your idea to use declarative status\nconstants is sensible. In fact, I would...
{ "AcceptedAnswerId": "263657", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T03:52:33.540", "Id": "263609", "Score": "4", "Tags": [ "python", "programming-challenge", "graph", "topological-sorting" ], "Title": "Python leetcode: scheduling courses t...
263609
<p>I've tried, as practise, to write a Python 3 script which takes a list of paths to files/directories and compresses them with <code>tar</code>, before encrypting the resultant tarball with <code>gpg</code> (for backing up to an external location). The script allows the user to choose which compression and encryption...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T05:11:58.150", "Id": "263611", "Score": "1", "Tags": [ "beginner", "python-3.x", "encryption" ], "Title": "Python script to compress and encrypt a list of files/directories (tar +...
263611
<p>I need to update a multidimensional array by same key paths of a multidimensional array.</p> <p>I think my code can be better condensed :</p> <pre class="lang-php prettyprint-override"><code>//source $array = [ &quot;hero&quot; =&gt; [ &quot;name&quot; =&gt; &quot;Peter&quot;, &quot;job&quot; =&gt; &quot;S...
[]
[ { "body": "<p>...wait a sec, am I sitting a job interview?</p>\n<p>Yes, we have a native function for this.</p>\n<p>Because your array structure is completely associative, <code>array_replace_recursive()</code> is reliable, concise, and self-documenting.</p>\n<p>Code: (<a href=\"https://3v4l.org/nXa56\" rel=\"n...
{ "AcceptedAnswerId": "263631", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T07:41:53.393", "Id": "263617", "Score": "1", "Tags": [ "php", "array" ], "Title": "PHP update multidimensional array values from same path multidmensional array" }
263617
<p>I am given a CSV file of stations, with data like this:</p> <pre><code>station_id,date,temperature_c 68,2000.375,10.500 68,2000.542,5.400 68,2000.958,23.000 68,2001.125,20.400 68,2001.292,13.300 68,2001.375,10.400 68,2001.958,21.800 68,2002.208,15.500 </code></pre> <p>and so on for many different <code>station_id</c...
[]
[ { "body": "<h1>Getters and Setters</h1>\n<p>If you are to use this pattern, the <code>@property</code> decorator will accomplish this in a more pythonic way:</p>\n<pre class=\"lang-py prettyprint-override\"><code>class Station:\n def __init__(self):\n self.readings = []\n self._minimum = 999999...
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T07:53:09.923", "Id": "263618", "Score": "1", "Tags": [ "python", "csv" ], "Title": "Python script for parsing and using CSV data" }
263618
<p>This is a problem of a past <a href="https://stepik.org/lesson/541850/step/2?unit=535311" rel="nofollow noreferrer">bioinformatic contest</a> (requires an account). My solution works but is too slow for some test cases.</p> <h3>Input format</h3> <p>The first line of the input contains one integer <span class="math-c...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T09:50:28.307", "Id": "520465", "Score": "0", "body": "You can avoid creating a dict+sorted list: \n1. Sort adducts. \n2. For each signal[i]-mass[j] look for (bisect) adduct." }, { "ContentLicense": "CC BY-SA 4.0", "C...
[ { "body": "<p>The complexity of your algorithm is:</p>\n<p>Creating a dict of values: <span class=\"math-container\">\\$O(MNlog(MN))\\$</span> (Loops for M and for N, log for adding into dict).</p>\n<p>Sorting keys: <span class=\"math-container\">\\$O(MNlog(MN))\\$</span> (sorting a list of the size MN)</p>\n<p...
{ "AcceptedAnswerId": "263627", "CommentCount": "6", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T08:04:58.837", "Id": "263620", "Score": "2", "Tags": [ "python", "performance", "python-3.x", "time-limit-exceeded" ], "Title": "Finding pair of numbers that minimize a fu...
263620
<h2>Background</h2> <p>I am devising a simple file format to store some (possibly large) binary data together with some metadata that specifies how the data was generated:</p> <pre><code>&lt;HEADER | 4 bytes&gt; (specifies 'size' of METADATA) &lt;METADATA | 'size' bytes&gt; &lt;DATA&gt; </code></pre> <p>The use case is...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T14:12:06.763", "Id": "520499", "Score": "0", "body": "I updated the code with the possibility to write to files. I am thinking that maybe I can specify the opening mode: `r`, `w`, `rw`, or even append, and have some sort of \"standa...
[ { "body": "<ul>\n<li>It's not necessary to represent this as a class; a read and write function will suffice</li>\n<li>Don't use double-underscores; that's reserved for name mangling</li>\n<li>The second argument of <code>Union[str, Path]</code> is more generically expressed as <code>os.PathLike</code></li>\n<l...
{ "AcceptedAnswerId": "263634", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T09:19:37.440", "Id": "263622", "Score": "1", "Tags": [ "python", "file" ], "Title": "Python class for handling custom file type" }
263622
<p>I'm using a site similar to SPOJ (in Portuguese, so I don't think linking it will help), where I need to find the number of different submasses in a given weighted string.</p> <p>Through the use of an iterative FFT I was able to process strings of size 10⁵ in under 8 seconds, but it still doesn't pass all the test c...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T11:41:29.720", "Id": "263624", "Score": "0", "Tags": [ "c#", "performance", "programming-challenge" ], "Title": "Find the number of different submasses in a weighted string" }
263624
<p>I have the following specific task, for which I have written code, in <strong>Rcpp</strong>, but it doesn't scale well and I would like to improve it. I'll describe first the steps of the procedure</p> <p><strong>Step 1</strong>:</p> <p>We have matrices of dimensions (K+1)x(K+1), which have non zero values on the po...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T13:39:44.783", "Id": "520493", "Score": "0", "body": "I am guessing that repeated calls of `Rcpp::rbinom` are the bottleneck. What is the current performance? and target?" }, { "ContentLicense": "CC BY-SA 4.0", "Creation...
[ { "body": "<p>Your <code>Direct_Matrix()</code> function is already doing things quite well; it mainly avoids going multiple times over the same memory. However, there might be some more improvements possible. First of all:</p>\n<pre><code>arma::mat H(N,K);\nH.zeros();\n</code></pre>\n<p>This zeroes all element...
{ "AcceptedAnswerId": "263642", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T12:37:05.927", "Id": "263626", "Score": "1", "Tags": [ "c++", "performance", "r", "rcpp" ], "Title": "Accelerating creation of matrices and finding ways for optimal scalin...
263626
<p>I want to count the missing values for each case in different sets of variables in a bigger dataset. Lets say in the mtcars between the variable <code>disp</code> and the variable <code>qsec</code> for each column.</p> <pre><code> # Dummy set.seed(1337) mtcars[round(runif(8,1,32)),round(runif(3,1,11))] &lt;- re...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-01T07:12:20.467", "Id": "520550", "Score": "0", "body": "\"contains a dataframe instead of just a numeric column\" would suggest this question is off-topic." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-0...
[]
{ "AcceptedAnswerId": null, "CommentCount": "2", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T15:07:46.497", "Id": "263633", "Score": "0", "Tags": [ "r" ], "Title": "R Count rowwise missing values for specific columns - dplyr cleanest version" }
263633
<p>Recently I needed to expand the exports in a file to all methods in order to allow for Jest tests to cover more of the code (without using <a href="https://github.com/jhnns/rewire" rel="nofollow noreferrer">Rewire</a>). Beforehand, only the functions used by other production files were exported, meaning unit tests o...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T19:39:09.263", "Id": "520509", "Score": "1", "body": "Welcome to Code Review! The current question title, which states your concerns about the code, is too general to be useful here. Please [edit] to the site standard, which is for ...
[ { "body": "<p>Well in your specific case, you are implementing the functionality of a calculator. The calculator has a public interface of what it can do. I do not think it makes sense to hide difference just because it is not used anywhere. You can still export it regardless of it being used or not.</p>\n<p>Al...
{ "AcceptedAnswerId": "263667", "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T17:07:54.533", "Id": "263635", "Score": "0", "Tags": [ "javascript", "unit-testing" ], "Title": "Unit tests for individual methods of a calculator" }
263635
<p>CodeSignal put out a challenge by Uber that involves writing a &quot;fare estimator&quot; that involves a function dependent on cost per minute, cost per mile, ride time and ride distance.</p> <p>The formula is along the lines of:</p> <pre><code>fare = (cost per minute) * (ride time) + (cost per mile) * (ride distan...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T19:40:26.973", "Id": "520510", "Score": "1", "body": "Can you show how you expect the function to be called? In particular, it helps to know what types the arguments will be." }, { "ContentLicense": "CC BY-SA 4.0", "Cre...
[ { "body": "<p>Here are a few tips:</p>\n<ul>\n<li><p>Unless it makes the code easier to read, avoid multiple assignments in one line. making your code shorter does not necessarily make it better, faster nor more maintainable.</p>\n</li>\n<li><p>Give better names to your variables</p>\n</li>\n<li><p>Use <a href=...
{ "AcceptedAnswerId": "263638", "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T17:21:41.857", "Id": "263636", "Score": "1", "Tags": [ "python-3.x", "programming-challenge", "lambda", "community-challenge" ], "Title": "An implementation of Uber's \"Fa...
263636
<p>I have created Snake game in Python. it is a single-player game, where the snake has to eat the red dots in order to grow longer. I just wanted to review if there is any improvements for the code.</p> <pre class="lang-py prettyprint-override"><code>import turtle import random import time screen = turtle.Screen() s...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T20:19:26.967", "Id": "263639", "Score": "3", "Tags": [ "python", "snake-game", "turtle-graphics" ], "Title": "Simple Snake Game in Python" }
263639
<p>I have a Send method that is working but want to refactor a portion where it is using PostAsync().Result and ReadAsStringAsync().Result. I've never written async methods before and don't feel I understand the core concept or pattern yet. Here is the original method:</p> <pre><code>public ServiceResult&lt;string&gt; ...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T21:01:32.833", "Id": "520513", "Score": "0", "body": "What is .NET version? Also read [this article](https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/using-objects) and about [Asynchronous programming](https://doc...
[ { "body": "<p>Welcome to Code Review.</p>\n<p>There's a lot of points that I may describe here, then I'll do it short.</p>\n<h3>Architecture</h3>\n<p>The wrong point here is sequence of instatiation settings for API helper class and the class itself. Originally instance created first, and only then the proberti...
{ "AcceptedAnswerId": "263659", "CommentCount": "4", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T20:20:31.713", "Id": "263640", "Score": "3", "Tags": [ "c#", "comparative-review", "async-await" ], "Title": "Posts data to endpoint, trying not to use .Result on async method...
263640
<p>I am the author of this code. It's from an actual project, and it returns the desired result. However, I am very concerned that I'm not defining my Model correctly.</p> <p>The Model is instantiated in the Controller. The Controller calls the instance of that Model. The Model defines itself via <code>.map()</code...
[]
[ { "body": "<h2>Naming: variables, methods</h2>\n<p>Many popular style guides (e.g. <a href=\"https://eslint.org/docs/developer-guide/code-conventions#naming\" rel=\"nofollow noreferrer\">esLint</a>, <a href=\"https://google.github.io/styleguide/jsguide.html#naming-method-names\" rel=\"nofollow noreferrer\">Goog...
{ "AcceptedAnswerId": "263646", "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T20:30:14.267", "Id": "263641", "Score": "5", "Tags": [ "javascript", "node.js", "mvc", "ecmascript-8" ], "Title": "Employee Model definition without an ORM" }
263641
<p><a href="https://github.com/mountbuild/tone-script" rel="nofollow noreferrer">Here</a> is some working code for converting an input string to an output string:</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...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-01T06:34:02.693", "Id": "520541", "Score": "1", "body": "I changed the title so that it describes what the code does per [site goals](/questions/how-to-ask): \"*State what your code does in your title, not your main concerns about it.*...
[ { "body": "<h3>One way to simplify</h3>\n<p>As far as I can tell, each of your <code>RegExp</code>s just looks at the start of your string for certain exact content - at that point you probably don't want <code>match</code> but <code>startsWith</code>, and you probably don't want to compile <code>RegExp</code>s...
{ "AcceptedAnswerId": null, "CommentCount": "1", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T20:45:52.493", "Id": "263643", "Score": "4", "Tags": [ "javascript", "performance", "parsing" ], "Title": "Convert ASCII representations of phonetics to Unicode characters" }
263643
<p>This is a follow-up question for <a href="https://codereview.stackexchange.com/q/260576/231235">Android APP connect to FTP server in Java</a> and <a href="https://codereview.stackexchange.com/q/261514/231235">Android APP FTP uploading file implementation in Java</a>. I am attempting to perform the download operation...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T22:32:19.493", "Id": "263644", "Score": "2", "Tags": [ "android", "file", "error-handling", "network-file-transfer", "ftp" ], "Title": "Android APP FTP downloading file im...
263644
<p>I am given a file named <code>profile1.data</code> that looks like this:</p> <pre><code> zone luminosity 1 1 1359.019 2 2 1359.030 3 3 1359.009 4 4 1358.988 5 5 1358.969 6 6 1358.951 </code></pre> <p>There are <em>thousands</em> of profiles in my working directory (named <code>profileN...
[ { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-01T06:46:55.960", "Id": "520545", "Score": "0", "body": "vectorized functions are mostly for math not creating hundreds of plots...." }, { "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-07-01T13:54:56.060", "Id...
[ { "body": "<p>As you haven't provided data or explanation what's <code>prof.idx$prof_num</code> I am guessing that's vector of file names (part of filename).\nThis could work:</p>\n<pre><code>prof_num &lt;- prof.idx$prof_num # vector of names? if so, should work\nprof.path &lt;- file.path(cwd,log.directory.afte...
{ "AcceptedAnswerId": null, "CommentCount": "3", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T22:51:21.687", "Id": "263649", "Score": "1", "Tags": [ "r" ], "Title": "R code for reading tabular data files and plotting light curves of modeled stars" }
263649
<p>I’m writing backend code for a website, and I’ve been surprised by the fact that a URL’s path component isn’t normalized at all, retaining trailing and duplicate slashes (<code>&quot;/foo&quot; != &quot;/foo/&quot; != &quot;/foo//&quot; != &quot;//foo/&quot;</code>, etc.), so I wrote a function to rectify this, but ...
[]
[]
{ "AcceptedAnswerId": null, "CommentCount": "0", "ContentLicense": "CC BY-SA 4.0", "CreationDate": "2021-06-30T23:53:22.990", "Id": "263652", "Score": "0", "Tags": [ "regex", "typescript", "url" ], "Title": "Normalizing URL pathnames in TypeScript" }
263652