« first day (3187 days earlier)      last day (116 days later) » 

12:00 AM
REFRESH! There are 8030 unanswered questions (89.2163 answered)
 
12:32 AM
0
Q: Generically calculate powers of two below a number

Simon ShineThe following function is an attempt to generate powers of two below the input number max. So powers_of_two_below(15u8, u8::BITS) generates 1, 2, 4, 8. It does calculate 16, but does not include it. This function avoids calculating powers that cause overflow by taking bits as input (since there d...

 
12:58 AM
0
Q: Try-catch-finally with 'using' in ADO.NET

Pablo Aguirre de SouzaI want to check if I'm correctly disposing of resources using Ado.NET. I'm not sure when the 'using' statement makes .Dispose() irrelevant. Please bear in mind I'm aware I shouldn't hardcode my SQL commands, this is just for training purposes. Thanks in advance! internal void CreateTable(string...

0
Q: Recursively delete directory using relative file system calls?

user254467int SavesFD; static int Recursive(const int File, const char *const Name) { const int File0 = openat(File, Name, O_DIRECTORY); if (File0 == -1) return 1; DIR *const Dir = fdopendir(File0); if (!Dir) return 1; for (struct dirent *Dirent; (Dirent = readdir(Dir));...

 
 
1 hour later…
2:01 AM
Welcome to Stack Overflow. Please take the tour and read about what's on-topic in the help center. We're not here to do open-ended code review. Specifically, what do you mean by 'I feel the "output_file" is too long'? — Chris 50 secs ago
 
2:17 AM
0
Q: Alpha Beta pruning minimax chess algorithm optimizations

syntaxerrorI'm a new programmer currently coding a javascript alpha-beta pruning minimax algorithm for my chess engine, using Chess.js and Chessboard.js. I've implemented a basic algorithm with move ordering. Currently, it's evaluating around 14000 nodes for 8 seconds, which is way too slow. Is there someth...

 
 
2 hours later…
4:21 AM
This question belongs to [codereview](codereview.stackexchange.com) — Reblochon Masque 10 secs ago
 
0
Q: Categorize similar transactions

user254476Please review the code to categorize some uncategorized objects: const categorizeSimilarTransactions = (transactions) => { if (!(Array.isArray(transactions) && transactions.length)) return []; const uncategorized = []; const categorized = []; const orderIds = transactions.map(t...

0
Q: C++ : Garage Sale Algorithm

frozencaI'm studying Dasgupta's "Algorithms". I solved this problem in C++: The garage sale problem. On a given Sunday morning, there are \$n\$ garage sales going on, \$g_{1}, \cdots, g_{n}\$. For each garage sale \$g_{j}\$ , you have an estimate of its value to you, \$v_{j}\$ . For any two garage sales...

 
5:16 AM
Monking
 
0
Q: Finding the minimum element of a stack of numbers

gparyaniAs part of an online programming challenge, I wrote a program that implements a stack of integers, supporting adding and removing elements, finding the last inserted element, and the minimum element. The premise is that all methods must be implemented in constant O(1) time. In my code, I opted to...

 
6:03 AM
possible answer invalidation by Susheel Busi on question by Susheel Busi: codereview.stackexchange.com/posts/273261/revisions
 
Monking
 
6:20 AM
@Duga seems ok. Adding example data
 
6:43 AM
@TipTop, you may looking for code review codereview.stackexchange.com, not stackoveflow. Also you should asking several questions on 1 question, this is considered not focused. You could consider accepting the answer if it solves one of questions — Shawn 33 secs ago
@Mast, sorry my misunderstanding about code review — Shawn 29 secs ago
 
 
2 hours later…
8:31 AM
@ChayimFriedman Ok I got your point. Yes, it does generate for addition, although with a different message. godbolt.org/z/n4v7qoqP6. But still, this is very useful within code reviews. I take it. — Jellyboy 31 secs ago
 
8:51 AM
codereview.stackexchange.com is a better forum for this. — Tyler Durden 14 secs ago
@TylerDurden No! If there are error messages, the code doesn't work yet. If the code doesn't work, it's explicitly off-topic at Code Review. — Mast 40 secs ago
 
0
Q: Pytorch: RuntimeError: mat1 dim 1 must match mat2 dim 0 using 2D CNN model with pretrained vgg_16

user254485 I am working on cardiac CT data(axial, sagittal, coronal). I am using the pre-trained model vgg_16. But got the following error. According to this error, my dimension is not correct but according to my code, I write things correctly Can somebody guide me regarding this I try to correct my code a...

 
9:49 AM
0
Q: Generic REST API feedback

sibertMy intention is to create an API as generic and DRY as possible using Go. To achieve this, I have made some more or less common decisions: To use AJAX call to avoid reloading page when updating the web page. Instead of using Go. To exclude hard coded queries from the API to reduce the endpoints ...

0
Q: Sim Registration Script for access to Internet

NathanDetails: Based on the input parameter to return corresponding output which is needed for setting & accessing Internet over interface [ppp0]. If the SIM is registered[ status = 1]. This script will be called in another based on cli. Code: #!/usr/bin/env python3 import os import datetime import sys...

 
10:15 AM
0
Q: Python: best way to setup a config library

pee2peeI am refactoring some legacy Python code and thought I'd put the config into it's own file as below. My question is whether I'm trying to be too clever with the last part? Could I just return the dictionary of endpoints and be done with it? The idea for the dictionary is that it could be shared a...

 
10:41 AM
0
Q: Python: How to use

pee2peeThis moves on from Python: best way to setup a config library slightly I have the following code which builds up a dictionary of endpoints that I iterate through later on. Is this the cleanest, most scalable and performant way? I was thinking of adding a list as a key to the library file with key...

 
11:13 AM
possible answer invalidation by AlwaysLearning on question by AlwaysLearning: codereview.stackexchange.com/posts/273282/revisions
 
11:34 AM
0
Q: How to use collection from Postman to send HTTP request and after updating the bearer token?

DurgaI am currently trying to automate API testing using Python. I have stored the API endpoints in a CSV file and read the data through the loop to fire the requests. But I am getting HTTP Error 400. The requested URL is invalid as it's unable to encode the link while extracting the URL from CSV. The...

 
11:50 AM
This question may be better suited for Code Review. — Bram Vanroy 33 secs ago
 
12:01 PM
0
Q: How can I optimize my code that contains 3 nested for loops

yosraI would appreciate to have your opinion on this code and whether I can refactor it and make it cleaner, I don't like the fact that I have 3 nested for loops, wi-hich makes the complexity of this code O(n3). categories = {} for k1, v1 in res["relationship_types"].items(): for k2, v...

 
12:53 PM
0
Q: Pandas: process data on dataframe subsets

Achille GI have written a piece of code which select each ID whose value equals something, then select a subset for each ID and then work with the subdata. My dataset has over a million entries, thus the code execution is very slow. Am I doing this the most appropriated way ? condition = (df["TYPE_APPEL"]...

 
1:20 PM
0
Q: Python: iterating with .items() or not?

pee2peeI have this code for endpoint in endpoints: if key in endpoints[endpoint]['keys']: yield endpoint pylint suggests iterating it with .items() for parent,child in endpoints.items(): if key in child['keys']: yield child Now when I do, I get a warning about an unused variabl...

 
1:46 PM
0
Q: linear search through an array

user1095108If you check the generated code for these functions: int a[]{1, 2, 3, 4, 5, 6, 7, 8}; auto find1(int const v) noexcept { auto p(a); [&]<auto ...I>(std::index_sequence<I...>) noexcept { ((*p == v ? true : (++p, I - I)) || ...); }(std::make_index_sequence<std::size(a)>()); return p...

 
1:58 PM
Maybe you're looking for a Code Review? — Fred Larson 58 secs ago
 
2:11 PM
I think this question is better post to codereview.stackexchange.comSimone Rossaini 38 secs ago
 
 
1 hour later…
3:17 PM
Alternatively, consider posting on Code Review: codereview.stackexchange.com/questions/tagged/mysql. Stackoverflow is for help with specific coding tasks that produce an expected error and can be solved. If you have working code, then Code Review is the better place to post this. — Tim Lewis 15 secs ago
 
3:59 PM
0
Q: Using TVP and MERGE to OUTPUT Inserted Variables and TVP Variables

izac33I have an application where a list of objects must be passed to an SQL stored procedure. The application needs to be aware of the unique ID that is has been given once inserted into the database. My idea is to pass many objects up to a stored procedure using a TVP, keeping it to a single query to...

 
4:10 PM
Monking
 
@CaptainObvious Doesn't really seem to be a request for a code review, definitely Missing Context.
Monking
 
4:26 PM
0
Q: QMediaPlay Pyqt5 Python

edu.sIs it right to put this code, inside this class, like this? playlist = QMediaPlaylist() url = QUrl.fromLocalFile("music.mp3") playlist.addMedia(QMediaContent(url)) playlist.setPlaybackMode(QMediaPlaylist.Loop) player = QMediaPlayer() player.setPlaylist(playlist) playe...

 
@CaptainObvious Possible duplicate question of this question.
 
4:52 PM
0
Q: Is there a faster way to write dictionary values to csv?

JThaoI have a dictionary that I am writing to a csv file, however I am only writing the values. I want to know if there is a faster way than using a for loop. I am using python 2.7 here is my code. empty = "" with open("parse_data.csv", "w") as f: for key, value in order_dic_keys....

 
5:03 PM
possible answer invalidation by user254467 on question by user254467: codereview.stackexchange.com/posts/273293/revisions
 
Monking
 
@Duga Appears to be in response to comment by @TobySpeight about includes
 
5:19 PM
0
Q: Copying a folder to another disk in python

Rosei have made this code to copy a folder to another disk, and it works, but i think there is a better way, the problem is if i don't use the replace, it says the folder exists and it is correct the 'T': is real. Can someone point me to the right path? src = folder_path folder_path_copy = folder_pat...

 
6:12 PM
0
Q: I create walls in a game from a random maze, how can I optimise and remove duplication from this code?

MunkybunkyI use four bools, if true a wall is in that direction bool top = true; bool bottom = true; bool left = true; bool right = true; Then I work through the four and create a wall for each //Create Walls if (top) { GameObject myWallSelection = WallSectionTop[Random.Range...

 
6:38 PM
0
Q: Python: token request, SQL user fetch and API calls

pee2peeI have the files as below. What I'm looking for is some feedback with regards to security, reliability, maintenance, scaling and performance. What is going on? Make a request to get a token to access some APIs. Use SQL to get a list of users. For each user, need to call 3/4 APIs and store the in...

 
Guest Post on January 24, 2022
What would you do if your code repositories suddenly stopped working?
 
7:05 PM
0
Q: Getting a single result from multiple LiveData objects

Moshe KatzI have an Android viewmodel for a Fragment that requires the user to perform multiple tasks. In addition to a LiveData object to track the status of each task, I also need a LiveData that tracks a summary of the status of all the tasks. I wrote the following MediatorLiveData class that takes a li...

 
7:53 PM
possible answer invalidation by pee2pee on question by pee2pee: codereview.stackexchange.com/posts/273325/revisions
 
8:17 PM
 
 
1 hour later…
9:23 PM
So it's not clear what you're looking for here. If the code works, and you want someone to review it, check the help center to see if your question can be made on topic on Code Review. Otherwise, tell us what exception is occurring and where. Just dumping a ton of code and asking volunteers to "make it better" is not really what Stack Overflow is about. See How to Ask for more tips. — Heretic Monkey 33 secs ago
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — gunr2171 25 secs ago
Hi gunr2171, I'm not looking for suggestions on how to improve it. However, I'm looking for the guiding academic principles that are not being adhered to. Would that still be a question for CodeReview.SE? Reading the requirements, I don't think this meets their requirements — tiredOwl 9 secs ago
 
9:44 PM
0
Q: Selenium Python webscraper really slow

yogi06I'm a newbie getting into web scrapers. I've made something that works, it takes 3.2 hours to complete job and randomly have 10 lines blank each time I run this job. Help is much appreciated! import sys import pandas as pd from selenium import webdriver import time from datetime import datetime ...

1
Q: Block-free priority lock

IncomputableBackground I wanted to write an event loop that supports scheduling, but found that no implementation of priority queue that I know of supports waiting on a condition variable (the idea is that the looping thread will wait on the condition variable and if the wait timed out, it means that it can ...

 
The usual process is to start code review based on a pull-request (this is how I understand the usage in BitBucket). It is acceptable to create the pull-request and mark it as in progress and you can always add more commits on the PR later. Your peers must be aware that you don't need immediate approval but just comments until you finish the feature (PR ready to be merged) — рüффп 14 secs ago
 
10:27 PM
that new design seems ... unfinished... where is the post excerpt?
I do like that the user card is slimmed down to a single line and the votes, answers and views are a tad smaller
 
0
Q: Creating database and two tables linked by foreign key

Pablo Aguirre de SouzaThese commands do what I want, but I'm trying to find out the best approach for this. My main areas of concern are: error handling and disposal of resources. In regards to error handling, I'm catching the errors by wrapping the caller in a try catch. In what concerns to disposal of resources, is ...

 
10:44 PM
@hc_dev These are valuable suggestions but StackOverflow is not a place for code review; that's what codereview.stackexchange.com is for. Hence, I just answered the OP's question with minimal modifications to their code. Anything else is out of scope. — a_guest 58 secs ago
 
@Vogel612 do you mean on the home page? it does show excerpts on the All Questions page
 
That's why use statements exist; you shouldn't have to be typing the identifier more than once per file. However, large number of constants sounds problematic, so there are probably issues with your structure. Fixing those kinds of things would be more appropriate for Code Review though. — Herohtar 11 secs ago
 
@SᴀᴍOnᴇᴌᴀ yup
 
11:04 PM
0
Q: Updating active cards that are dynamically added by an API

Bram MortierI am making a website where you can search trough all the countries in the world. Once you have found a country you want more detail about you should be able to click and view a detailed page with more info. I am having troubles with updating the countries that are currently shown with the users ...

0
Q: Async generator that processes input enumerable in batches-at-a-time

theonlygustiI have a lot of Input documents, which contain collections of sentences. I would like to use an online sentiment API to attach sentiments to each of these sentences (how positive or negative the sentence is, on a scale of 0.0 to 1.0). My code returns, for each Input, an Output which contains a mo...

 
11:57 PM
0
Q: Python module to print in printer

Dante S.I made a code that simplifies the job of sending anything to print with the windows api. The module has a Document object which stores a reference to the actual device context within it. You can access some of the real dc functions, like Document.dc.Polygon to draw polygons. Any recommendation or...

 

« first day (3187 days earlier)      last day (116 days later) »