« first day (2357 days earlier)      last day (27 days later) » 

12:00 AM
RELOAD! There are 6188 unanswered questions (90.1032% answered)
12:29 AM
Q: Python image combiner reading writing

Take That 101I am writing a simple script that will combine two images at a pixel level, selecting every other pixel from one image, and the other pixels from a second image. from PIL import Image import struct print("Photo 1: ", end="") photo1 = Image.open(input()) # First image, 1920 by 1080 photo1 = pho...

12:47 AM
Perhaps you want codereview.stackexchange.com. Be even there, the purpose is to request a review to improve performance, etc. It's not a code repository or voting system. — C Perkins 44 secs ago
Q: Algorithm for building a string by appending and cloning substrings

esperskiI have a problem where I need to construct a given string from scratch for a minimum cost by either: Appending a new character for a cost A Appending a substring of my existing string for a cost B E.g. for a string "abcabc" with a cost of A = 10, B = 11 a 10 ab 20 abc 30 abcabc 41 First I tr...

1:10 AM
Q: Maximum element in Unique Path

Siddhant SinghProblem Statement:- Max has a garden full of roses. He planted roses in a certain pattern of rows and columns. Say there are N rows and M columns. Max has to move from start to finish in a minimum number of steps so that he is able to collect maximum roses along the way. While collecting the flo...

Q: What improvements can be made to this Java code for a bowling scoring game

Chris HalcrowI've prepared a tenpin bowling scoring game in Java - https://github.com/chalcrow/DiusBowlingGame I'd like a critical review of the code to identify potential improvements. The code runs like this: Main.java package com.dius.bowling; public class Main { private DiusBowlingGame game; ...

1 hour later…
2:31 AM
Q: AssertionError when using matplotlib errorbars

ZacharyCI have been really struggling to figure out why this code isn't working. I have a list of ufloat values(from uncertainties package), and I am trying to plot them with the uncertainties as the y-value errorbars. However, I keep getting an AssertionError. Why doesn't it work, and what exactly is an...

3:01 AM
If you have a working code and is looking for a review, you might want to check codereview.stackexchange.com instead — Andreas 1 min ago
3:33 AM
Q: Active Directory security groups Search application optimization

TARUNI have a Web API method that returns the Active Directory security groups for the specific login user. The below code was working fine but it was taking so munch time nearly 45 sec to get the results. DirectoryEntry root = GetDirectoryEntry() using (var groups = root.Children.Find("OU=Sample ...

4:30 AM
2 hours later…
6:15 AM
If I read that backtrace correctly (its formatting is a bit messed up), then this is far away from your code. Your code (you should take it to codereview.stackexchange.com, btw, there's lots to improve) doesn't look like it could cause that to me. The only obvious mistake is the lack of virtual destructors. — Ulrich Eckhardt 24 secs ago
6:42 AM
@jensgram thank you very much - join codereview.stackexchange.com and help us to create better software =) — Martin Frank 25 secs ago
6:58 AM
Q: Google Foorbar - Prepare the Bunnies' Escape

user211542I have been working on Google Foobar for a few days. I am currently stuck in the "Prepare the Bunnies' Escape." challenge. I have checked some earlier posts but it still could not pass the hidden test cases. For reference, here is the challenge: You have maps of parts of the space station, eac...

Q: Spreadsheet to increment two levels of data indices

NewSitesI'm posting this after reviewing the Meta Q&A, Non-code formula spreadsheet, and I believe I've got something here that meets the criteria there. Occasionally I find myself analyzing data that I need to turn into a spreadsheet with two levels of indices. For example, from the mock data: Authors...

2 hours later…
8:40 AM
Q: Print based debuging

outoftime#include <iostream> const bool DEBUG = false; template <typename ... Args> void debug(Args ... args); template <typename ... Args> void _debug(Args ... args) { std::cout << "[" << __FILE__ << ":" << __LINE__ << "] "; (std::cout << ... << args) << std::endl; } #define debug(args...) if...

Then that's a question for codereview.stackexchange.com. Do you have any reason to think it's not correct? Have you tested it? — Jon Skeet 22 secs ago
8:56 AM
I'm voting to close this question as off-topic because requests to "improve" working code are more suited to CodeReview.SE but the OP should check that Exchanges criteria first. — Paulie_D 30 secs ago
9:09 AM
This might be better suited to codereview.stackexchange.comDiado 29 secs ago
agree on the "codereview" thing, but my advice: "look at tools like Dapper" — Marc Gravell ♦ 37 secs ago
9:25 AM
@JonSkeet: On Code Review it is expected that the “code works correctly, to the best of the author's knowledge.” Any question mentioning “I got an error” will most probably be closed quickly. — Martin R 31 secs ago
9:41 AM
Q: Min Heap Tree Implementation in python 3

brijesh kalkaniI wrote a min-heap using a binary tee. How can I improve the time complexity of insert and delete function to log(n)? Thank you ''' Min Heap Tree Implementation ''' class Node: def __init__(self, data): self.data = data self.left = None self.right = None class HeapB...

10:01 AM
Q: Not sending XML command with header via TCP/IP using Java

Sanjay VekariyaThis code is part of java application that I use for sending an XML command with a header to a server over TCP/IP. The server responds back with the XML data. I want to send XML request using the following instruction : I would like to ask about your opinion about my code. import java.io.IOEx...

10:19 AM
Well, it was only a guess.. if I downvote I try to leave a comment so the question can either be improved or deleted.. (except it is of a very poor quality, then I don't waste more time for explaining then was obviously used to ask) .. don't take it personal.. Maybe this question would better fit stack exchange site "code review".. — Roland 52 secs ago
10:42 AM
Q: High Performance Blocking Queue C#

Arjun VachhaniI am developing a high-performance(real-time) system, it requires message passing between its component. speed and accuracy is at most priority. I have explored a few options. ConcurrentQueue<T> is super fast BlockingCollection<T> provides a better API. also BlockingCollection<T> waits for the pr...

11:02 AM
@Duga Did you get a badge for that?
@MartinR ^^
possible answer invalidation by outoftime on question by outoftime: codereview.stackexchange.com/posts/230891/revisions
@Duga rolled back
1 hour later…
12:31 PM
Your question should be at codereview.stackexchange.comVencovsky 57 secs ago
1:05 PM
Q: WebSockets with functional components

John SmithI'm using websockets in my React application. The application is supposed to consist of function components only. Imagine the application consists of two "tabs": one irrelevant, and the other one, a chat using websockets. Given that, we want to whip up a websocket connection once the user enters...

1:22 PM
I don't see this question getting any useful answer, I think you should add more context (maybe in another question) as to why you need to save some bytes, in which context and the kind of data you're handling. If it's a piece of code that uses too much memory, you could ask the CodeReview SE how you could optimize it memory-wise. If it's data persisted on disk, there might be smarter encoding schemes than the one you're using. If you're wondering how to solve frequent OutOfMemoryError or a panicked GC, you might want to learn how to analyse heap dumps — Aaron 38 secs ago
What's your issue/question? Questions about general advice or code reviews are not appropriate for Stack Overflow. — Scott Marcus 17 secs ago
Q: Iterator for traversing a tree

Christopher BooWhat I want to achieve is the following: #include "tree.h" #include <iostream> int main() { Tree<std::string>* tA = new Tree<std::string>("A"); Tree<std::string>* tB = new Tree<std::string>("B", tA); Tree<std::string>* tC = new Tree<std::string>("C", tA); Tree<std::string>* tD = new Tree

2:06 PM
Q: OOP parsing for DB dump XML Python

JaneI am parsing large XML (DB dump). So, the content looks like many different objects with their properties and dependencies (foreign keys). My way to do it - using lxml.etree (iterparse): def insert_db(content): for item in xml_parser(content): if isinstance(item, DPoint):...

Q: Implementing an Angular custom control with validation

ANevesI've built a custom control to handle user input in a human-readable format, but save in a machine-format. It needs to have input validation, and to convert UI-input to a base format. I'm interested in knowing: Have I implemented this in a proper and idiomatic Angular way? Are there any UI and...

Q: cleaning up c# code which connects to sql database using windows form

Henry Petersusing System; using System.Data; using System.Data.SqlClient; using System.Windows.Forms; namespace FinalDatabaseConnection { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //if statment dealing with sql queries once butto...

2:18 PM
If the code works and just needs improvement, this might be better asked at codereview.stackexchange.comlurker 23 secs ago
Q: HttpClient Wrapper for standardized API communication

AaronThis is our company's first attempt at an API and a mobile friendly web project, primarily we are desktop developers. We are using Identity Server 4 for serving up tokens and authentication, we have a mobile friendly web application and an API. I did a lot of the groundwork setting up the commun...

3:07 PM
Q: Token Bucket context manager for rate limiting async calls

PocketsandI've written a class that implements something akin to the token bucket algorithm so that I may rate limit aysnc HTTP requests made from my application. The code works but I'm still not sure if it feels 'right', maybe just because I am new to async programming in Python. Specific concerns: It...

3:35 PM
Would this be better on codereview.stackexchange ? — Robin Bennett 33 secs ago
Ryland Goldstein on October 17, 2019

This is the first in an ongoing series from developers expressing their opinions on various topics in the software engineering and computer science world. The opinions expressed here are solely those of the author. If you disagree, drop a comment and let us know your take—respectfully, of course.

I suspect that a lot of people will interpret this article as “gatekeeping.”  Although I can understand that perspective, I’ve strived to provide an honest outlook that reflects my experience over the last few years (mostly startups). I also want to explicitly disclaim that I will be focusing on f …

4:02 PM
Q: Improving the speed of loop in javascript for objects

Manny K SoSoSo I have a loop that works great, but doing some testing I notice it is a bit slow. I get an average time within the loop of about 0.11 seconds. Include that with some arrays containing a length of over 100 and the time starts making a big difference. So I mainly want to improve the speed of the...

4:29 PM
Q: Is this a good way to achieve encapsulation in C++?

Sergey Teryanclass C { public: char ch; C() { ch = '$'; } }; int main() { void* object = new C(); { C* const temp = (C*)object; temp->ch = 'B'; std::cout << temp->ch << std::endl; } delete object; return 0; } The idea is to make a pointer...

Q: Javascript Simple Calculator

Steve NgaiI just refactored my Javascript calculator and added some extra features and trying to solve using different solutions. How could I refactor my code further? Any comments are welcome. Thanks in advance. "use strict"; var lastOperand, lastInputIsOperator, lastOperator, tempResult; // 12. las...

4:46 PM
If your code is working and you only want to improve it then you might try posting your question at Code Review...codereview.stackexchange.comquaabaam 48 secs ago
Q: Matrix Sum problem solution in java

Aashish PawarI was solving the HackerEarth problem. Problem statement is stated below. You are given a nxm matrix. You need to print the sum of all the numbers in the rectangle which has (1,1) as the top left corner and (x,y) as the bottom right corner. Here's my solution import java.util.*; public cla...

Q: Capitalize the First Letter of Words in a String (JavaScript, Python)

EmmaProblem Write a function that accepts a string, capitalizes the first letter of each word in the string, and returns the capitalized string. Examples function('a short sentence') => 'A Short Sentence' function('a lazy fox') => 'A Lazy Fox' function('look, it is working!') => 'Look, It Is Worki...

5:10 PM
Q: effectively run through test conditions

Marek SeberaGiven this example private function compareTwo($first, $second) { $result = $first->param === $second->param; $result = $result && $first->param2 === $second->param2; $result = $result && $first->param3 === $second->param3; $result = $result && $this->runDiff...

5:52 PM
@Vogel612 @410_Gone My SO question has been reopened: stackoverflow.com/q/58416402/1310566 Feel free to provide a good answer if you have one :)
thanks for the heads up. I'll just finish up my work here and then see what I can do
1 hour later…
6:52 PM
@SimonForsberg I can't read the JLS so my answer is no better than the one you got :P
why do people not do proper transaction management?
7:12 PM
Q: Printing character in a string based upon index inputted by user

hazeyThe issue I'm having is, if I put in a string such as 'red' and then ask for index of 3 which is larger than the length, I get no output, but if I enter an index of 4 I will then get my intended result of '?'. I don't understand why it's skipping over the first appearance of an index greater than...

My question is likely to get closed, but I'm a risk taker today!
Q: The Best™ class

Simon ForsbergHave you ever wanted to get just not one "best" element from a list, but all of them, or a random element of the best ones? That's what the Best class is here for. Opinion-based? Definitely not! Features: Should work with any kind of element. Should always keep track of the best elements seen ...

My patience today has been exhausted.
@410_Gone me too
@410_Gone Oh oh, what happened now?
I hope it gets better.
7:21 PM
@brug Is something new going on on MSE?
Just the same unending vitriol
Except most of the reasonable people have fled because it is nasty and it is turning into an echo chamber of hate.
@SimonForsberg @rolfl I guess you don't speak Kotlin, but I'd love your opinion on this one. I think it's a class you might like (it is the Best after all)
@pacmaninbw A certain person at work is trying to make a mountain out of a molehill.
@brug Anything worth reading?
@SimonForsberg UGH I hate how you format your Kotlin.
7:24 PM
@410_Gone What's wrong with it? Because it uses Egyptian braces?
It just, I don't like it at all.
fun randomBest(): T {
    return bestElements.random()
@410_Gone Sorry to hear. I wish it was MSE drama. That seems easier to walk away from.
I would make all those one-line.
@brug It is what it is...I made it clear that we are not going to address this any time soon because we have money-makers that are not working we need to fix first.
@410_Gone Ugh... that's actually possible...
fun firstBest(): T = bestElements.first()
@SimonForsberg That's why I hate it...lol More whitespace than I prefer too
7:26 PM
    fun randomBest(): T = bestElements.random()
    fun getBest(): List<T> = bestElements.toList()
    fun firstBest(): T = bestElements.first()
    fun isBest(element: T): Boolean = bestElements.contains(element)
    fun getBestValue(): Double = bestValue
Much better
@410_Gone Asking for permission to invalidate your chat message :)
@SimonForsberg Feel free. :)
Much better.
I honestly forgot about that feature
Much like C# and Java I don't do whitespace after opening or before closing braces, but it's really up to you.
7:28 PM
Thanks for reminding me how awesome Kotlin is
It's a great tool. :)
@410_Gone Example?
You mean empty new lines or what?
No empty line after thing {, just start the stuff.
class Best<T>(private val valueFunction: (T) -> Double) {

    private var bestValue: Double = Double.NEGATIVE_INFINITY
class Best<T>(private val valueFunction: (T) -> Double) {
    private var bestValue: Double = Double.NEGATIVE_INFINITY
Instead of the first, I do the second.
But, that's a stylistic choice.
Aha. Yeah, for some reason I found it more pleasing to do the first.
Well if you're going to do the first, do it everywhere.
So for your test class, add a break before the closing brace.
7:33 PM
Q: The Best™ class

Simon ForsbergHave you ever wanted to get just not one "best" element from a list, but all of them, or a random element of the best ones? That's what the Best class is here for. Opinion-based? Definitely not! Features: Should work with any kind of element. Should always keep track of the best elements seen ...

@410_Gone Huh, turns out that was actually a copy-paste error from my code
Well good, because now you have an answer. ;)
@SimonForsberg I wrote my answer without an IDE so I might have syntax messed up, but the point stands.
7:53 PM
@410_Gone Point understood, comment added
Already responded. ;)
But, subclass, provide your own functions for those, and create the valueFunction version.
Subclass, hmm? Well, classes in Kotlin are final by default, surely I could make it open, but I'm not sure it can be done in a nice and clean way
You don't have to subclass, but my point is there are ways to do it.
@SimonForsberg I think I can pronounce it correctly .... but that's about it.
@brug Always something new...yay.... :/
8:05 PM
A: Why was my username changed without notice and can I change it again?

fixer1234I used to view freedom as a license to do pretty much anything that wasn't illegal or unethical. If someone else was bothered by it, it was their freedom to be bothered or not bothered by whatever they chose. They could choose to react differently to it; there was no requirement for them to rea...

Q: Does Stack Exchange, Inc. really care about the LGBTQ+ community?

BelovedFoolDoes Stack Exchange, Inc. really care about us? Because it doesn't feel like that. Meta is burning with hatred and heinous speech and SE Inc. is nowhere to be seen. Sure, they made a post that apologizes for that (among other things) ten days ago. Sure, they are handling flags and removing bad...

If the code is complete and works and you just want improvements, it should be on Code Review. This site is primarily for fixing broken code. — Carcigenicate 55 secs ago
@brug ....
@410_Gone That was a nice example because it will really hit home to the alt-right extremists
Not that I expect them to be swayed.
@brug @410_Gone That answer is quite good isn't it? Or is there something wrong with that answer that I'm missing?
@SimonForsberg I was referring to the question and situation with my comment.
yeah the presumptuousness of the question is a bit preposterous.
@410_Gone Ah, right.
Yeah, the reason for why the answer was required in the first place is a bit sad
@brug Those are two words I am A) very impressed that you (supposedly) can spell. B) not sure what they mean.
@brug I'm not a mod because I would not "assume good faith".
I mean a moderator on another site was actually arguing that the name should stand
@SimonForsberg the fact that the user thought we were stupid enough to buy their act is extremely absurd.
also, I have a spell check extension.
@brug I'd need a dictionary extension
8:24 PM
@SimonForsberg Don't you mean thesaurus?
Well, English is my first language. So I know some of the big words
Or even better: Inverse dictionary. If I write something normal, I'd like some tool to translate it into something fancy.
Occasionally I throw them around to make sure everyone else knows I know them.
Gotta scare people away, eh? ;)
@410_Gone WIL (Words I Learn)
8:25 PM
I was being entirely facetious.
@410_Gone I had a feeling about that. (And that's actually a somewhat fancy word I actually know!)
8:38 PM
@Vogel612 may I ask for your assistance at codereview.stackexchange.com/a/23580/31562 ? This is a reason why I don't like force-deleting code-only answers, they were plenty of useful things there, it just needed someone to add a brief description about what's going on.
9:02 PM
hi! just going to leave this here:
A: Dear Stack Exchange: a statement and a letter from your moderators

Cesar MThank you for writing to us about this. This isn’t our final response here, but in the interest of being transparent and keeping lines of communication open, we wanted to respond with something as soon as possible. While this isn’t the answer you’ve been looking for, we wanted to update you on so...

We have also a code review process, but we think that it is better to have also an automated process. — Bilel Chaouadi 15 secs ago
9:35 PM
Q: Code is returning an eigenvalue of 0 but should not

mattsprestigeThe code I am writing is for the Jacobi method of approximating eigenvalues. I keep getting eigenvalues of 0 for any size matrix even though by hand I am not getting eigenvalues of 0. I think that my code might be resetting my matrix A to all zeroes somewhere. import numpy from numpy import * fr...

9:57 PM
When you get this working take it for a code review codereview.stackexchange.com (needs to work first though). — Martin York 23 secs ago
10:16 PM
Q: Python: Finding combinations

Ruler Of The WorldI have a list, to make it easier to understand it's structure I'll write it out like so: mylist = [[["a","b","c","d"]...]...] Where the ... means the previous list is repeated (although the values inside may change) An example list would be: mylist = [[["a","b","c","d"], ["e","f","g","h"]], ...

11:12 PM
This might be best asked over in code review, I think. Only 6 variables seems a bit few for me to add a region for. That is +2 lines to hide 6 lines, saving only 4 lines when folded in. — Christopher 38 secs ago

« first day (2357 days earlier)      last day (27 days later) »