« first day (2532 days earlier)      last day (53 days later) » 

12:00 AM
RELOAD! There are 6477 unanswered questions (90.1167% answered)
 
0
Q: Efficient way to find the greatest result of A mod M in a range of numbers

PencilKnotI am writing a code that takes two numbers N and M and finds the greatest result of A mod M for all the numbers of A in the range 1,2,3,...,N-1,N. 1 ≤ N,M ≤ 10^9 My code is: public static void main(String[] args) throws IOException { long n=readLong(), m=readLong(), a=Integer.MIN_VALUE; ...

 
12:59 AM
I was about to comment a lot when I realized that this belongs on code reviewTed Lyngmo 50 secs ago
 
 
2 hours later…
2:56 AM
0
Q: Can nested functions be overused or abused? When are they appropriate?

gatorI've been writing a tutorial for neural networks and every time I come across my neural network initialization function, I wonder if my use of nested functions is inappropriate and broader, if nested functions are ever appropriate. def initialize_network(n, h, o): """Neural network initializ...

 
3:15 AM
0
Q: Download pictures (or videos) from Instagram using Selenium

AlexDotisPython script that can downloads public and private profiles images and videos, like Gallery with photos or videos. It saves the data in the folder. How it works: Log in in instragram using selenium and navigate to the profile Checking the availability of Instagram profile if it's private or e...

 
 
2 hours later…
4:51 AM
0
Q: This is the program to test the number of days in a month.I tried writing a program but it checks it is valid or not

Akshatha SDefine the is_legitimate_date() function which is passed a string as a parameter. The function returns a boolean indicating whether the string denotes a legitimate date. You are given 2 global variables which you may use in your solution: MONTH_NAMES is a list of month names, and DAYS_IN_MONTH ...

 
5:09 AM
0
Q: Mastermind game

Adam DodsonI've just finished one of my first projects with a GUI using PyQt5 and I recreated mastermind the board game. The game is played by inputting 4 numbers and getting a return of how many of the numbers are in the code but in the wrong spot and how many numbers are correct (a random 4 digit combo b...

 
5:41 AM
if you reformulate the answer in your post as something like 'I tried the following script, but the problem is that I have to specify the branches every time', it fits in the SO Q&A format. Currently, you are leaving it up to us to determine what needs improvement, making it better suited for codereview.stackexchange.com — TamaMcGlinn 11 secs ago
Once you have this running, submit it at codereview.stackexchange.com. There are several things bad in your code. — Ulrich Eckhardt 1 min ago
 
6:07 AM
@DerKommissar Nice work.
@Peilonrayz Shiny.
@Peilonrayz @SᴀᴍOnᴇᴌᴀ Pasting code that's hosted elsewhere has legality issues, hence we don't do that. We'd be forcing SE's licensing model on code and most of us don't have the expertise to figure out whether that's a) permissible b) legal c) a good idea. Often enough it's neither.
Turning existing code already included in the question itself into a snippet should be fine since the code is already under SE by then.
But honestly, if that hadn't been accepted by the OP himself, I'd have been tempted to rollback or at least leave a comment stating the possibility if preferred.
 
What I mean is if the time.Sleep is not so apparently like the code above, and it's hard to find it out by code review. How can I find it by using profiling tool (pprof) or something else. — chanjarster 24 secs ago
 
6:55 AM
Seems like this belongs on codereview.stackexchange.comZer0 9 secs ago
@Zer0 Absolutely not, since the actual code is missing. This is too much turned into an example. Perhaps if a site like Design Review would exist (and thus, perhaps Programmers would take it), but it's absolutely unsuitable for Code Review. — Mast 28 secs ago
 
0
Q: Continue url string after search query

JayApologies for the day 1 basic question, I'm just trying to build a simple tool that searches the same query across multiple sites. However some sites have a string that needs to be entered after the query for the URL to be recognised. if selection =='1': webbrowser.open('http://goog...

 
7:21 AM
0
Q: Optimizing Object Pool with freelist

darpan1118I am following tutorial from GameProgrammingPattern book. I tried to create an object pool using it. I want to know how can I improve it. Its an fixed size pool so there will not be any runtime increase or decrease in pool size. Coin.h #pragma once class Coin { public: Coin(); ~Coin();...

 
7:51 AM
Thank you for your comments. I will post on code review instead and check out the linked examples. Cheers! — Emanuel Lindström 6 secs ago
 
8:23 AM
This would be better suited to codereview.stackexchange.comNick 9 secs ago
 
8:42 AM
@brunodesthuilliers the question is not about proper exception handling and I make no claim about my solution being correct in terms of "proper" exception handling, since that's way off-topic. The OP wants to know why his exception is cancelled away, and I explain this providing an example of how to fix this. Delving into the possible fallacies of the OP's code is for codereview.stackexchange.com, not SO. — GPhilo 15 secs ago
 
9:02 AM
@brunodesthuilliers Added a warning for further users. As per "good answers should go past the simple technical answer by mentioning bad and good practices, possible improvements etc.", I disagree. An answer must focus on the posed question, not on all possible fallacies therein. If the OP is interested in a code review, again, there are better-suited places for that. — GPhilo 15 secs ago
 
9:14 AM
-1
Q: Importing data from spreadsheet

GlenUKNot really an issue I am stuck on (the code works) but I just really don't like some code I wrote, if you're bored in lockdown maybe you might like to help. Context: I am import some data from a spreadsheet, it contains data about retail stores (grocery stores). As the data comes in from the spr...

 
10:11 AM
0
Q: Random Quote Machine with React and Bootstrap

Ogatron3000For my first solo React exercise project I decided to recreate a quote machine from the example that uses vanilla JS/jQuery. I also used a mix of Bootstrap/plain CSS. I got it to look how I wanted and do what I wanted, but I am not sure if my code follows best practices. All feedback is much appr...

 
I still don't understand why people teach how to write C code in C++. You won't pass any serious code review. You are learning how to write legacy code. I understand that it makes sense to know about these language elements but you shouldn't start with it. — Thomas Sablik 27 secs ago
@Vitaliy Well now we are in 2020 and I currently have IntelliJ IDEA 2019.3.4 (Community Edition) Build #IC-193.6911.18, built on March 17, 2020 Runtime version: 11.0.6+8-b520.43 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.15.4 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 12 Registry: Non-Bundled Plugins: BashSupport, CheckStyle-IDEA, DBN, codeReview4idea, com.andrey4623.rainbowcsv, com.godwin.json.parser, net.seesharpsoft.intellij.plugins.csv, training — Nitin Ramac 32 secs ago
possible answer invalidation by greybeard on question by Joe Smith: codereview.stackexchange.com/posts/240190/revisions
 
11:27 AM
1
Q: python binary exponentation with modulo - effectiveness?

MrFishWhat is the most effective way of implementing the binary exponentiation in python? This is my approach def quad_pow(base, exponent, modul): alpha = (bin(exponent).replace('0b', ''))[::-1] a = 1 b = base for i in range(0, len(alpha)): if int(alph...

 
11:37 AM
What is your actual problem? For code reviews it is recommended to use codereview.stackexchange.comJonasH 16 secs ago
 
12:19 PM
@Mast 1.1 million PPD right now...
 
0
Q: python extended euclidean algorithm feedback

MrFishI tried to programm the extended euclidean algorithm from scratch. Is this a good aproach? Any feedback is welcome. def ext_ggT(a, b): x,y, u,v = 0,1, 1,0 while a != 0: q, r = b//a, b%a m, n = x-u*q, y-v*q b,a, x,y, u,v = a,r, u,v, m,n ...

-1
Q: When to require and when to provide through arguments

BodzioSamolotI've been wondering what is the preferred way of injecting dependencies in node.js code. I've been working on a project where there is no dependency injection. This is why i have 2 ways of providing dependencies in my code: through constructor/function arguments - this has the disadvantage of...

 
12:42 PM
-1
Q: Create View in iOS - Swift

sasquatchI've started creating views Programmatically and I am not sure if I am doing it right. My questions are at the bottom. I got a working Login View via the following code: import UIKit import Moya import SnapKit class LoginViewController: UIViewController { let provider = MoyaProvider<Api>(...

 
1:01 PM
-1
Q: Modelling user preference system with categories

hal5kI am modelling a user preference system with the following requirements a user can have attributes (foods they eat) a user can have dynamic categories of preferences users which have all their categories with at least one intersect can match So far I have used Postgres's arrays to build a sy...

 
1:39 PM
0
Q: Is there any way to clean up this c# structure?

Sstack324I'm wondering if there is any way to clean up this c# structure. I feel like it is a bit messy...Is it possible to accomplish the same functionality but without all the nested code. class Display { private byte option { get; set; } public void init() { while (true) ...

 
0
Q: How to improve my question?

chrysaetos99how can I improve this question of mine? I already edited it, and I already set a bounty to get more attention, but I still don't get many answers. Is there something significantly wrong with this question? I would appreciate any suggestions.

 
1:54 PM
@Feeds Sometimes I wonder how many askers aren't entitled.
 
@Peilonrayz Well, since you recently asked a question, hopefully at least one? :P
 
@Graipher lol
 
@Peilonrayz And it's not even a great question.
The original nor the meta.
 
2:09 PM
@Mast I find what qualifies a great question comes down to the non-code part of the question. I don't think askers realize that it plays a vital role in getting people engaged in the question.
 
0
Q: Simpson's method for numerically computing the integration of a function

user366312I have implemented the Simpson's rule for numerical integration. Check this video for the implemented function. namespace Simpsons_method_of_integration { //https://www.youtube.com/watch?v=ns3k-Lz7qWU using System; public class Simpson { private double Function(double ...

-1
Q: Code to support different measurement systems

DestroyerI am developing an application in which the user can use different measurement systems. Currently, there is support for the metric and imperial measurement systems. To support these systems, I wrote a converter. Could you take a look at its code and tell how can it be improved and what are the p...

 
@Peilonrayz I think a lot of askers don't realize a lot of things we consider common sense when asking questions or we wouldn't be closing so many questions.
@CaptainObvious Although I'm not sure why that got downvoted. Am I missing something?
 
@Mast You and me both. Maybe someone's downvote quota hasn't been reached yet?
2
 
@Mast Especially because that question for once does not have a bad description. Informative and to the point.
 
Jason Punyon on April 09, 2020
Unfriendly comments are an issue in our system because of the effect that their tone has on their recipient’s and future readers’ willingness to contribute to Stack Overflow. The solution to these issues isn’t to argue about circumstance or intent. The only remaining option is to work on the comments themselves.
 
2:22 PM
@Graipher That's what I thought.
@Feeds That's a lot of text with little content...
I'd like to see a list of what they consider helpful, constructive comments as alternatives to what they list as unhelpful ones.
 
This question is more likely for Codereview, IMHO. — Kosh 39 secs ago
 
-1
Q: Generating perfect numbers using for loops in Python3

M.RaP_FreAk47I tried to generate perfect numbers from 2 up to 500 with some simple "for loops" (which I've learned recently) in Python 3 and I've faced a wrong answer in addition to the 3 correct answers. input: lik=[] lis=[[[]],[[]]] for n in range(2,500): lis.append([]) for y in range (1,n): ...

 
3:09 PM
@Mast @Graipher I just saw it in the queues with a broken vote... Hmmmmmm
 
3:51 PM
0
Q: code improvement suggestion on scroll function to check element in view

jtnptl89This chunk of code below look for the class name and apply in-view class when it does. I was looking for code improvement suggestion. Most of the time this code fires when scroll event happen. Code works great but i have a doubt that this code is the one that is most expensive in my code base. If...

 
@Peilonrayz @Mast Perhaps someone that doesn't understand English all that well misunderstood the statement help find problems.
 
@pacmaninbw I'm confused, I've ctrl-fed "help" and the only one I can find is in the footer.
 
@pacmaninbw do you mean the last part of that last sentence - i.e. "tell how can it be improved and what are the problems of this code"?
 
@SᴀᴍOnᴇᴌᴀ @Peilonrayz Sorry, Sam found what is what I was referencing.
 
"what are the problems of this code" is such a common pattern in questions that anyone with 3k should know that it's more likely an IPS problem then a code problem.
 
4:05 PM
Yes, but we have some rather strict members of the community. I removed that part of the sentence.
 
Yeah, unfortunatly that's true. :(
 
4:31 PM
I'm voting to close this question as off-topic because SO doesn't improve working code. Try codereview.SE — Sam Axe 55 secs ago
 
4:47 PM
-1
Q: concatenation of html from return functions

MatoeilMy controller is looking something like this. Is there a better way to generate my html to render coming from different functions: $html = $renderer->render($clear_form); $html .= $this->render_preview(); $config = \Drupal::config('amu_import_ldap.settings'); if (null != $config) { $subm...

 
@SᴀᴍOnᴇᴌᴀ Did you VTC this? The close vote I'm seeing in the reviews and your comment don't align.
 
Code Review might be a better place, but a few things. Pass by reference, not copy. Reserve space for your unodered_sets — ChrisMM 31 secs ago
 
Ok, I'll write a comment that aligns with that reason
I don't think it was K00lman as they don't have 3k
 
5:25 PM
0
Q: Reverse String : Recursion

Pushpak Sharmawe have to reverse char[] using recursion. Input: ["H","a","n","n","a","h"] Output: ["h","a","n","n","a","H"] package codeMonk; public class RevereseString { public char[] reverseStr(char[] reversedString, int startIndex , int lastIndex, int midIndex) { // Base Condition ...

 
5:38 PM
Great, just tried it and so far it is working. Ill write some code up and post it on Code Review, would you mind reviewing? — Jose 6 secs ago
i never go to code review, but glad to hear you have it working. with css there typically isnt too much to optimize (for speed) since it's not exactly a compiled language, but you may be able to use fewer lines in the end... — braX 28 secs ago
 
6:03 PM
0
Q: naive bayes sentiment analysis classifier in clojure

a.kattaching my try on implementing simple naive-bayes classifier for sentiment analysis as part of learning clojure and using functional programming on ML algorithms. I tried to invest more time in code readability, functional-operations & mindset rather than efficiency (there are clearly parts in...

 
Anyone here use the pg8000 PostgreSQL driver for Python?
 
6:22 PM
Then you should try to write a program that reads from your text file and shows it in a system modal dialog box. Once you've attempted to do this, and have some code, you might be able to get more targetted assistance here (Stack Overflow) or in Code Review. — Jeff Zeitlin 36 secs ago
 
0
Q: jQuery form.find radio class

JeffersonIn my application we have four inputs radio controls and on the load the value is checked to true. When the user select another radio and then save the form I want to get the new value. I am using the find class but then I need to use checked[0] is there a better way to do this? JS $("#form").s...

 
6:36 PM
@DerKommissar No, what's the problem?
 
No problem.
Just wondered how anyone felt about it.
Or, if anyone has better recommendations for a PostgreSQL driver for Python I'm all ears as well.
 
Ah, I've never really worked with SQL so I'm no help here :(
 
@DerKommissar Never worked with Postgres.
 
6:52 PM
What things can I do to make my C code run faster?... Post it on Code Reviewryyker 15 secs ago
 
I prefer Postgres to MySQL (which is the alternative for what I need to do) by a landslide.
@Peilonrayz Bummer, it's a really fun time.
And that's not sarcasm.
 
@DerKommissar The little I've messed with SEDE it seems cool. But after trying to setup SQL in my programmer infancy I've never had a desire to use it again.
 
0
Q: Calculator Object Oriented Design

BiancaI am aiming to implement a calculator in an object-oriented way. Here is the solution by using the strategy pattern. Looking forward to some valuable comments. package oopdesign.calculator; public class AdditionStrategy implements CalculationStrategy { @Override public int calculate(...

 
7:09 PM
@Peilonrayz SEDE is T-SQL which is similar, but different in some very specific ways from Postgre.
The newer Microsoft SQL Server (T-SQL) is super easy to setup. As is the newer PostgreSQL or MySQL, honestly.
MySQL seems to always have performance issues on a phenomenal scale when I use it, so I'm avoiding it for...a while...
Postgres has always felt good to me, though I have traditionally been Windows-only.
In the last 5 years my environment has shifted to a more blended environment.
And JetBrains DataGrip makes doing anything in SQL super simple. It is such a lifesaver.
 
hai I heard SQL lol
 
No you didn't
Liar
Do you even log into Skype anymore?
 
7:30 PM
@DerKommissar Now that you mention it...
Was still logged to it on my mobile, but not been getting any notifications
*blames Microsoft*
 
Mhmm
Oh hey look now there's a green icon next to your name. Finally.
 
lol
 
lol
 
Hey look the little icon moved to show you read my messages.
Wow.
Only took several months
 
@DerKommissar Aren't there DB-independent libraries for Python that act as a wrapper to support basically anything?
 
7:43 PM
I have no idea lol
 
It's Python. Good chance there are.
 
October 26, 2019.
Wow @Phrancis
 
@DerKommissar I believe Simon has used Postgres for @Duga and other things, but he was using Java/Kotlin rather than Python.
 
Yeah I'm using Python here
I mean this lib seems to be working fine, though technically I haven't tested anything.
 
I bet it's gonna be fine
 
7:45 PM
Gonna use the REPL to test quick
 
@DerKommissar SQLAlchemy, an ORM
 
Gross
Alright so I had to change a couple minor things but pg8000 works.
elliottbrown$ python test.py
Success
Boom
 
0
Q: Board Rotation Problem - Best Practices

Peter ChikovProblem: You are given a board containing letters and a word that you have to form. You can only take the letters from the front or the back, hence you have to rotate the board left or right. You have to use the greedy approach and get a list of rotations necessary to get the word. Code: ...

 
8:05 PM
@DerKommissar Have you tried MariaDB which started on the MySQL code base but is not supported by Oracle.
 
Yeah, seems just as slow.
Running any kind of SQL aggregate on relatively large data is a no-go with it.
 
Are you using the Inno DB driver?
 
Granted I was pushing it to the extreme, trying to aggregate a few hundred thousand rows with an RPi.
I have no idea.
 
The Inno setting makes it faster.
 
-1
Q: Trying to understand a Monty Hall simulation code in Python

mrgouAs part of a classroom exercise, I'm trying to understand the code of a Monty Hall simulation found here: https://openclassrooms.com/fr/courses/4452741-decouvrez-les-librairies-python-pour-la-data-science/4740937-decouvrez-le-probleme-de-monty-hall#/id/r-4770995 (apologies for not providing an E...

 
8:16 PM
The problem is nothing can make MySQL fast lol
 
Practice proper code indentation. It's an important tool when trying to understand and debug code. Also, on SO, code must be syntactically correct to get help otherwise it's off-topic. Your code appears to have been wrapped, which broke all the embedded commenting and would cause syntax errors. As the code stands, it will be rejected from codereview because it won't run. I unwrapped the comments, but please be more careful. — the Tin Man 52 secs ago
 
8:34 PM
0
Q: OOP comic book web scraper in Python

Practical1I'm relatively new to python and web scraping in general, As such, this is my first major web scraping program in python. My code works nonetheless, I'm just not sure if it's the best OOP design. I have some doubts about how much instance variables I've used Would refactoring this code as a bun...

 
8:53 PM
0
Q: Idiomatic F# for iterating a li

Kerry PerretI've written a function that takes a sequence and check for every item in that sequence whether the current value a selection (obtained with a selection function) is different from the previous computed value and if that's the case, then map the current item and returns a new mapped item along th...

 
9:15 PM
Aside, this would be a good question for Code Review Stack Exchange—and especially since you have working code. Generally, Stack Overflow shies away from opinion-based questions like “what is the best approach?” since they don’t lend themselves to a single, concrete answer. — Jeremy Caney 22 secs ago
 
9:50 PM
0
Q: Better approach in AngularJS variables

Yash KarankeI am fairly new to AngularJS, and currently, I am learning $http. Every time I make a request and get the response to it, I store that response in a variable and then inject it in the $scope, like below. $http({ method : "GET", url : "https://api.covid19api.com/summary" }...

-1
Q: Min heap without recursion

Darnoc ElocThe code reads in integer array from user input and builds a minimum heap via an iterative scheme. Are there any edge cases in which this approach would fail? #include <iostream> #include <string> #include <sstream> #include <stdexcept> #include <cmath> int readheap(int* theheap) { std::str...

 
possible answer invalidation by Joe Smith on question by Joe Smith: codereview.stackexchange.com/posts/240190/revisions
 
 
1 hour later…
11:05 PM
-1
Q: Java pagination algorithm

John R.I made a pagination algorithm but in my opinion it is too complicated and it is quite difficult to be understood. This algorithm should show 5 pages where in the middle is the current page. It should also show two pages before and two pages after the selected page (if these pages exist). So,...

 
11:26 PM
To be clear -- we require questions to be about specific problems. Code for which no problem is known belongs on Code Review, but is off-topic here. (Note that there are other criteria required for acceptability on CR; before posting there, read A Guide To Code Review For Stack Overflow Users in full). — Charles Duffy 40 secs ago
 
11:53 PM
Here is a Morse code emitter local codereview.stackexchange.com/a/71246/507 I am sure you could reverse it to get an inputter. — Martin York 59 secs ago
 

« first day (2532 days earlier)      last day (53 days later) »