« first day (2860 days earlier)      last day (51 days later) » 

12:00 AM
RELOAD! There are 7356 unanswered questions (89.5980% answered)
 
12:16 AM
0
Q: Retrieving top-level opening and closing sequences from a Python string

IterniamThe problem I'm solving is a more complex version of pairing up opening and closing brackets. Instead of matching only on ([{}]), I additionally need to match arbitrary opening sequences of arbitrary length to closing sequences of arbitrary length, such as '(' which is mapped to ')'. Motivation: ...

0
Q: dynamic_pointer_cast for std::unique_ptr

Diederick C. Niehorsterdynamic_pointer_cast is only implemented for std::shared_ptr, I need it for unique pointers. The wrinkle is that dynamic_casting a pointer could fail (yield nullptr), what to do in that case? I decided that in that case i would like the original pointer to remain intact. So i have implemented the...

 
12:37 AM
Not the best, but you will get an idea hereCool Cloud 37 secs ago
 
0
Q: Create a divisors list and indetify primary numbers

donbonbonNB - it's my first post here. If my question isn't in the right place, please inform so I can improve. I tackled a beginners' exercise: "asks the user for a number and then prints out a list of all the divisors of that number." NB - I reviewed similar questions in this forum but decided to post t...

0
Q: Security of CS50 Calculator code

M-Chen-3This is my first question on Code Review, so please let me know if I botched anything. After working for quite a while on my CS50 calculator, it has finally reached the point where I am completely satisfied with how it works. However, since it is hosted on Google Sites, I'm slightly worried about...

 
 
1 hour later…
1:54 AM
0
Q: Adding keys/values together

SkyinfernoI'm using python 3.7 and I am using multiple dictionaries. Some of the keys are present in both dictionaries, some are not. Most of the values are numbers. dict1 = {'a': 2, 'b': 3} dict2 = {'c': 'Hello', 'a': 2} I want to end up with a third dictionary that contains all of the keys, but if they ...

0
Q: Is my Flask social site endpoint cleanly written?

atulwWhat I have here is a relatively simple endpoint for a small site I'm making. Idea is to take: title content tags and create an entry in the database. It works properly. I threw this together as something that should work and tried to make it clean (like with the error list that gets returned) ...

 
 
2 hours later…
3:31 AM
0
Q: Find Least Number of Swaps to Sort List

Star ManHere is my (working) code that finds the least number of swaps to sort a list in ascending order. import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Sort_Swap { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ...

 
 
1 hour later…
5:07 AM
Monking
 
5:57 AM
0
Q: Pokemon Soul Link tracker code evaluation

TempsI've just finished writing a program to help track Pokemon across Soul Links. For those curious I will include a link to what a Soul Link is. The goal of the program is to take in the names of the two Pokemon alongside the route that they were caught on. The Pokemon is then added to a table for t...

 
6:32 AM
Maybe this question is better asked at [codereview.stackexchange.com/](codereview.stackexchange.com‌​) . Nice to know would also be if the amount of data changes, and what are you doing with it then? Say first request you get those 3 rows, 2 request you get 4 rows but one from the first request is now missing. So remove it, keep it, mark it... ? too many options which are not clear — caramba 5 secs ago
 
6:45 AM
The Number of rows (tickers) will be fixed. and order of Response is also same always. I want to Just updating Price Cell continuously. So that I can get Real-time Stock Prices(2seconds interval though) Thank you for answer about codereview.stackexchange. — reaver lover 18 secs ago
 
7:10 AM
0
Q: I have a C++ iterator that adds an extra layer of indirection

bradgonesurfingThe below iterator is designed with one purpose in mind. If before you had an iterator where you could do int x = *it; now you do int x = **make_wrap_iterator(it); This is useful for example if you want to use a range based for loop to produce iterators to each element rather than values. You c...

0
Q: Most Effective way of fetching data and then notating html table with JavaScript

reaver loverI want to notate Stock prices with html table. The Number of rows (tickers) will be fixed. and order of Response is also same always. I want to Just updating Price Cell continuously. Price data is come from other REST API server and I'll fetch this data on every 2 seconds. and The Data will be no...

 
8:00 AM
Please post you code as text, additionally if it is working it may be best placed on codereview.stackexchange.comUser1010 49 secs ago
 
8:20 AM
possible answer invalidation by Iterniam on question by Iterniam: codereview.stackexchange.com/posts/256650/revisions
 
8:35 AM
possible answer invalidation by Iterniam on question by Iterniam: codereview.stackexchange.com/posts/256650/revisions
@dylosaur yes that is ok, I wanted to say that the code itself is not good and I hope it would not pass a code review if there is no other restriction — RoQuOTriX 16 secs ago
 
8:48 AM
0
Q: Simple folder/file lock handler

MattyI have two python scripts (or one bash script + one python script) which are working independently from another, one script puts data into a folder, the other one reads from it. Since I don't want to accidentally read from the folder at the same time it's updated, I created this simple folder loc...

0
Q: Queue related Codeforces problem in C++

kowsihan sk question - https://codeforces.com/contest/91/problem/B my solution is getting time limit error after 15 test cases and i couldn't come up with a better solution. can't find it in internet too. Please help me with the logic. my code : #include <bits/stdc++.h> using namespace std; #define ll lon...

 
8:59 AM
This isn't a code review site. There is a lot of code here and no clear error. It is up to you as a developer to profile and debug these things yourself. If you're running into a specific, concrete issue, that is when SO questions should be asked. — Qix - MONICA WAS MISTREATED 43 secs ago
 
9:49 AM
@Yunnosch, imagine that I'm going to allocate some memory then read something sensitive (e.g. a private key) into that block and do something with it. Later, I allocate some memory of the same size and stick some data into it that will be saved to a file. If I don't overwrite all the data in the block then it may contain some sensitive info that would get saved to the file. In that case, it may not be obvious from a code review that some sensitive data exfiltration is possible. I want to demonstrate that sensitive data can be exfiltrated in a non-obvious manner. — Grezzo 58 secs ago
 
10:08 AM
@klutt: The question clearly indicates the purpose. Op seeks to demonstrate malicious actor, such as an employee with access to the source code, can exploit properties of memory allocation to exfiltrate code in spite of code reviews that ensure memory is freed when it is no longer needed for the program’s intended purpose. Studying how software or hardware may be exploited by malicious actors is a valid and valuable pursuit. — Eric Postpischil 12 secs ago
 
10:19 AM
The only problem you had was matching a pipe symbol, so the closure is correct. If your solution is working well for you and there is no issue, consider asking at Code Review. — Wiktor Stribiżew 44 secs ago
 
 
1 hour later…
11:39 AM
0
Q: Remove redundancies in similar properties

Enrique Moreno TentI have a lot of redundancy here, but I am not sure how could I make it look shorter. namespace Notan { public class EquipmentSystem : ScriptableObject { public UnityEvent onUpdate = new UnityEvent(); [SerializeField] private Weapon weapon1; public Weapon Weapon1 ...

0
Q: dynamic queue implementation in C++

dammiHello everyone I've implemented a dynamic queue along side with a randkm access iterator, can I get a review ? And thanks in advance. iterator: #pragma once #include <iterator> namespace con { template <class T> class rnd_iterator { T *m_Ptr; public: /* * type aliases */ using value...

 
12:03 PM
0
Q: How should I use overloads with proper type annotations?

staticdevI have a CLI lib to automate batch operations on GitHub with many use cases: create issue, merge PR, delete branch... Since they all operate in a similar fashing regarding execution and output, I created a parent class GhUseCase as follows: class GhUseCase: # ...other methods def action(s...

 
 
3 hours later…
2:53 PM
Greetings, Programs.
 
Roberta Arcoverde on March 03, 2021
In order to get the most performant site possible when building the codebase for our public Stack Overflow site, we didn’t always follow best practices.
 
3:19 PM
0
Q: How to make my code more OOP?

AaronHi ive finished my code but i want to make it shorter and more OOP. Can anyone help me out? The question The cost to become a member of a fitness center is as follows: a. the Senior citizens discount is 30%; b. if the membership is bought and paid for 12 or more months in advance, the discount is...

 
 
1 hour later…
4:32 PM
0
Q: Python Stack Datastructure

Akash PatelI attempted to implement a stack based on functional programming. Specifically, the idea is to allow structural sharing to reduce space usage. To do structural sharing, I added a unique key for the stack. This stack data structure allows deletion in two ways. First, the stack might be popped. Sec...

 
Greetings, possessors of neural networks
 
4:57 PM
0
Q: What could be the purpose of having the repo class here?

makomwebI am wrapping my head around this class design. Can you help me identify the advantage of having the Repository class here? Repository::save() is indeed implemented with forwarding the call to Model::save(). class Model { private string _name; public Model(string name) { _nam...

 
 
1 hour later…
6:05 PM
@CaptainObvious AOC 3MCVN
 
6:27 PM
@Mast deleted
 
0
Q: Find all of the paths that lead to the minimum sum

Athn"Find minimum path sum" in a 2D grid, is a very popular question which is solved by dynamic programming. But what if instead of the minimum sum value, we return all the actual paths that lead to the minimum sum path? This was an interview question which has been puzzling me. The original problem ...

 
6:59 PM
posted on March 03, 2021 by Binny

It is taking much more time to execute the script than expected. For just 1250 records, it is taking 20 plus minutes to loop and insert into the table. Please let us know if this is normal Below are the 11 columns fetched from API(JSON) and loading each row into the table(oracle). script : auth_values = (user, passwd) response = requests.get(url, auth=auth_values) json_data = js

 
@CaptainObvious occasionally that format (i.e. heading starting with recent questions, no user avatar, sub-heading with date and user )is used - I wonder why that format is used?
maybe that is the default format and there is a URL that isn't picked up so that default text doesn't get replaced?
 
@SᴀᴍOnᴇᴌᴀ There was a reason for that, but I forgot.
Possibly that a question was deleted and restored during the grace period, I'm not sure at all.
 
This is not a code review platform. What is your specific question? — calas 55 secs ago
 
@Feeds Interesting approach, might try that for my current project.
 
7:20 PM
@SᴀᴍOnᴇᴌᴀ @Mast is right, about deletes. I don't think deletes have grace periods, so I think here we have a TOCTOU (cacheing) bug
 
It's definitely a caching thing.
 
0
Q: JavaScript OOD: 2048

JojiI wrote a 2048 game in JavaScript with a object-oriented paradigm. The game board is presented with a two-dimensional array and each tile holds an integer. Here is the implementation: class Game { SIZE = 4 constructor() { this.board = Array.from({ length: this.SIZE * this.SIZE }, () => 0)...

 
...which may be a double-edged sword...
 
7:47 PM
0
Q: ForEach Methods Implementation for Multidimensional Array in C#

JimmyHuI am working with System.Array and I found that the input parameter of ForEach method public static void ForEach<T>(T[] array, Action<T> action); is specified on one dimensional array case. I am trying to generalize this to multidimensional array. The experimental implementation Here's the experi...

 
7:59 PM
@SᴀᴍOnᴇᴌᴀ PHP is a double-edged sword...
 
 
1 hour later…
9:25 PM
0
Q: Beginner python solution to CSES "Permutations"

t.y.lerI'm working through the CSES problem set as I learn to program, and this solution was accepted, but I'm not quite happy with it. I just know there's a faster way to check whether or not a solution's valid instead of looping through every element, and I'm sure there're plenty more improvements tha...

 
9:49 PM
0
Q: Is there a better way to calculate joint probability?

M-Chen-3After a long struggle, I've completed the Heredity project of "CS50's Introduction to Artificial Intelligence". However, I feel like my solution was not the most dignified way of doing it. So for this particular function that I was working on, the goal is to calculate the joint probability of man...

0
Q: Using haversine to order by distance

Lewis MorrisI'm trying to write a search by location into a website. I cant help but think that the code I've written is not very efficient. If I were to have 1000's of places it would be fairly slow. Any improvements? This is a psuedo version. import haversine class Place(db.Model): name = "TEST" lat...

 
This may be the kind of problem that someone on CodeReview would like to tackle, especially if it just uses Python lists (and not arrays). But read the forum's requirements. They tend to be picky(ier) about complete runnable code. — hpaulj 28 secs ago
 
10:38 PM
0
Q: Clean way to remove an identical nested object in javascript

wittgensteincan you give me some feedback about my approach to remove an idential element from following data structure? const items = { 'Sun Mar 07 2021': [ { id: 2 }, { id: 1 } ], 'Sat Mar 06 2021': [ { id: 1 } // remove me ] } const id = 1 // filter by id 1 const newDate = 'Sun Mar...

 
This question seems more inline with Code Review. Code Review Stack Exchange is a question and answer site for peer programmer code reviews. Stackoverflow is more on-topic for questions about problems and algorithms. — lorem ipsum 48 secs ago
 

« first day (2860 days earlier)      last day (51 days later) »