« first day (1971 days earlier)      last day (2037 days later) » 

12:00 AM
RELOAD! There are 5625 unanswered questions (89.8654% answered)
 
12:34 AM
0
Q: Login System with SQL running smoothly but incorrect output

Tyler KanzI'm unsure if it has to do if how the query parameters or if its somewhere after but I keep coming out with my else statement. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System....

 
 
2 hours later…
2:28 AM
0
Q: Update specific property in array object with React

Sarin SuriyakoonThis is the structure of the state this.state = { cardList: [ { id: 1, imagepath: '', type: '', price: '', detail: '' } ] } This is the function than receive number to select which array index of object will be replaced. And text is a variable that nee...

0
Q: Binary search tree with common operations

Brady DeanI trying to see if I implemented these operations correctly and if they could be optimized in any way. The implementations are just the typical implementations found online but I adjusted them to work with pointers. I did not find pseudocode for transplant, it was only described and I am unsure i...

 
Code Review: Using option.lower() == "quit" will do a better job of handling input with "any capitalization". This has the free benefit of avoid the or statements that are seemingly confusing you. — Shadow 44 secs ago
 
 
2 hours later…
4:09 AM
Monking
@CaptainObvious broken
 
4:37 AM
0
Q: Enhance performance of loop in Python3

Han Van PhamSorry for saying that I'm a newbie in Python. I need to read a GZ file contains thousands of users. But I think my code is not optimized in this case. Could anyone can help me? What should I do to improve performance? Or is it standard? if os.path.isfile("file.gz"): with gzip.GzipF...

 
5:27 AM
0
Q: inserting node in the middle of a linked list in c++

Mustafa AL-JaburiIm trying to build a function to insert node in the middle of a single linked list. but im getting output of zeros. 00000000000 only. can you check what im doing wrong? #include <iostream> using namespace std; struct node { int data; node *next;}; node *head = nullptr; node *temp; vo...

 
6:21 AM
@Heslacher Possibly, but it has no close votes yet.
Monking
@CaptainObvious That's broken.
 
@Mast I have linked the wrong question :-(
 
@Heslacher Ah, which did you have in mind?
 
@CaptainObvious this
 
@Heslacher Put in the 5th. Thank you.
 
@Mast no, thank you !
 
7:05 AM
0
Q: Basic probability simulations in Python

kamalbangaI have been learning Probability from Statistics 110 and trying to simulate problems that have an unintuitive answer from numpy import cumsum from statistics import mean from numpy.random import poisson, exponential from random import randint, sample, uniform from bisect import bisect_left def ...

 
7:21 AM
0
Q: Why this program won't work?

Siddharth GawasHasan is a computer science student, he likes his study field, especially programming and algorithms, but he doesn’t like attending classes at all since they are very boring, especially that the quality of education in his college is extremely low, but sometimes he is forced to attend in order to...

 
@CaptainObvious That's an interesting style of writing Python. I kind of like it.
Well-written too, the only thing lacking is the Python version.
That's the kind of question I'd love to see from all new users.
 
7:37 AM
0
Q: Writing XML in C# from defined schema

SilentRage47I'm creating an XML from a defined schema I need to follow. This is my code: using (XmlWriter writer = XmlWriter.Create(desktopPath + "\fatt.xml", settings)) { writer.WriteStartDocument(); #region FatturaElettronicaHeader 1 writer.WriteStartElement("FatturaElettronicaHeader"); #regio...

 
7:53 AM
0
Q: C++20 multithread pool

MercerThis is an iteration from a prior post; C++ multithread pool class. Class for creating thread pools with upcoming C++20 standard (-std=gnu++2a -fconcepts). Please review code correctness, best practices, design and implementation. Please assume the namespace Mercer is to be used as a cross-pla...

 
8:36 AM
If i was your code reviewer id send not those back... in short its ok to put things on more than one line, infact it makes it more readable. — Saruman 34 secs ago
 
9:07 AM
I'm voting to close this question as off-topic because SO is not a place for code review. — Bhojendra Rauniyar 12 secs ago
 
9:29 AM
This is a question for codereview.stackexchange.com . The code that was posted doesn't seem to be duplicated. — estus 17 secs ago
 
0
Q: AVL Tree with delete method in Python 3

Paul KJust a general code review. I'm looking for my first developer job so anything constructive is awesome. Please, and thank you very much. I've written this implementation as an exercise and to add to my code base. I've tried to keep most nuts and bolts hidden away in the Node class. """AVLTree/B...

 
10:04 AM
0
Q: Login System using PHP and PDO Prepared Statement

user236945896vir.php <?php require_once '../db.php'; session_start(); if($_SERVER['REQUEST_METHOD'] == 'POST'){ $username = trim($_POST['username']); try{ $Query = "SELECT * FROM users WHERE username = :username"; $statement = $conn->prepare($Query); $statement->bindValue(':username', $username...

 
10:22 AM
0
Q: Progress bar wrapper class in C++

ZathorixI've recently written a simple progress bar class in C++ to mimic usage of similar libraries I've used in Python. The idea is to take some iterable container (e.g. std::vector), and iterate over the container while printing the progress to stdout. This can be useful when doing some computationall...

 
10:45 AM
possible answer invalidation by shaggs on question by shaggs: codereview.stackexchange.com/posts/157322/revisions
possible answer invalidation by Dmitry Volkov on question by Dmitry Volkov: codereview.stackexchange.com/posts/204220/revisions
 
0
Q: Separate business logic from ORM models in SQLAlchemy

hambos22I have a Flask application with tens of complex models, almost all of them related to each other. A simple pseudo-schema of some of them: +----------------+ | FoodGroup | +-------+--------+ ^ | +-------+--------+ | Food +<------+ +---+------------+ | ...

 
11:22 AM
@Duga This looks like it needs moderator intervention — user erased own question and replaced text with "Removed from so for personal reasons".
 
12:15 PM
0
Q: Best Approach for Assignment Code in Node.js (ES6 style)

DanishIs there any way to improve this code? Using ES6 style i am using latest stable version of node.js. const UserSchema = new mongoose.Schema({ date: string; dateObj: { year: number, month: number, day: number }; project: string; task: string; hours: number; }); let data = new Data(); ...

 
Monkiing
@GarethRees you are within your rights to roll back stuff like that on your own. We mods don't really do anything else either.
The only time being a mod is an "advantage" is if there's a rollback war around this
 
12:48 PM
0
Q: Performance - search name or phone

DanielI have a website and I need to look up through a list of contact. The list can contain around 10k users and depends on the logged user. This is a user public class User { public User() { Name = string.Empty; LastName = string.Empty; } ...

0
Q: Manage Game Level with enum

Prashant TukadiyaBasically What I have is basket ball App. In which I have Added some levels and difficulties. logic is simply use tupple in enum and I have some methods to update / get current level with new values I have created following code enum Difficulty:String { case easy case medium case ...

 
1:20 PM
1
Q: Fixed-sized memory pool in C

Jim MorrisonI'm learning C and I am currently implementing a memory pool. I'm writing it in steps, first I implemented a fixed-sized memory pool then I will try to implement a memory pool with a known size of elements but an unknown number of elements and ultimately try to write a generic one that is just a...

0
Q: A 2 player dice game2019

音ERASED楽The players roll two six sided dice each and get points depending on what they roll. There 5 rounds in a game in each round each player rolls the 2 dice. THE RULES ARE .The points rolled on each players dice are added to the score .If the total is an even number, an additional 10 points are adde...

 
1:52 PM
0
Q: Capacitance computation due to DC Bias - Python modelisation

MathieuI am modeling a capacitor which has its capacitance varying according to the DC Bias. The DC Bias is computed by taking the mean of the voltage across the capacitance. class CAP: """ Represents the Capacitor. """ def __init__(self, nominal_capacitance): # Theoretical capa...

 
2:12 PM
 
@Vogel612 Was [contact] here supposed to resolve to a hyperlink automagically? If so, it didn't.
 
was a shot in the dark.
not really necessary for that to resolve to a magic link
 
2:39 PM
found in an open-source maven plugin:
 
0
Q: Subtable timestamps in python pandas

Datas AI have a dataframe like: time_stamp id next_timestamp 0 2010-04-16 11:57:52 string_1 NaT 1 2010-04-16 12:06:16 string_1 NaT 2 2010-04-16 12:40:53 string_2 NaT And I want to fill next_timestamp column, with: - The next time_stamp that id has (if exists). Result would be som...

 
} else {
    throw new RuntimeException("Fuck you Maven!");
}
weeeeelll...
 
@Vogel612 At least it shows what goes wrong.
 
nah
 
"This should work. It might not. If it doesn't work, there's nothing we can do about it. Blame Maven instead."
 
2:41 PM
the actual issue is that eclipse somehow gets it's fingers into the guts of maven sometimes
and that changes how you can interact with maven internally, because who would follow the liskov substitution principle, right?
 
@Vogel612 yuck
 
2:56 PM
bleargh
"dependency exclusion filters do not attempt to prune dependency trees"
this is ridiculous
 
3:08 PM
This is stuff for the angry gods of legacy software...
how come that a core part of a core dependency manager in the java language has been completely and utterly abandoned?`
Did nobody notice of am I just too dumb to find stuff?
 
Sounds like you're having fun :-)
 
0
Q: Robin Round + FCFS Scheduling Algorithm Seidel for LCP

noname_clearI'm trying to write an application that implements the FCFS scheduling algoritm and the Robin Rowd scheduling system when performing the SLAU solver processes with the Seidel method with different initial data. Who understands such things and can help to collect this all in a heap? At most not v...

0
Q: circular game in python 3.7.4 every person

Rock Karthikin python language Cicular Game There are N students in a class. In games period they are made to stand in a circle and each one of them is given a unique random number, r. Here r1 is the random number assigned for the first student, r2 is the number assigned for the second student and so on. In ...

 
^^ freshly checked out from source control
I just noticed and it's making me really angry
 
3:25 PM
Monking
 
deprecation and replacement notices are really not something that the eclipse foundation is good at...
 
3:44 PM
@CaptainObvious heh
> Please complete good luck
 
I'm voting to close this question as off-topic because questions about improving working code should be asked on Code Review. — TylerH just now
 
posted on September 26, 2018 by CommitStrip

 
@SᴀᴍOnᴇᴌᴀ
I can't help but wonder... Why do I always get to have fun with discontinued, outdated or half-dead dependencies that have some kind of bug or issue?
bleh
 
4:09 PM
what kind of dependencies?
 
Monking
@Vogel612 I see... tabs?
 
@skiwi mixed indentation
 
huh?
 
method starts with spaces, first two lines in method are indented with four spaces and then tabs
the rest of the method is indented with tabs
 
Ah... now I see, wtf
 
4:13 PM
like... I don't care whether you prefer tabs or spaces, as long as you frigging stick to it
 
I just realized the cause of a bug just before I went home
We're implementing a webbrowser control and just today I noticed it was using significantly more memory than the one we're replacing
Memory issues was one of the reasons that we were replacing it... but okay the old one really had memory leaks
Turns out it is directly coupled to the size of the freaking client
Turns out using an ElementHost to be able to host a WPF control inside a WinForms application is not just a bad idea, it's a terribly bad idea
Apparently a redraw can already cost 30 MB and it will stay there until the garbage collector has ran
Because of 3440 * 1440 * 4 * 2 aka screen resolution * number of colors * buffer depth
 
4:31 PM
@Habitate I would suggest you open a question on CodeReview: codereview.stackexchange.comBrad Allred 16 secs ago
 
4:48 PM
@skiwi Reminds me of a bug we have in our system. All of the applications have more or less stable memory usage, but the task manager reports that we lose about 50MB/3s, which leads to a total system freeze after about 8 hours, unless we kill the graphical user interface.
System vendor has yet to release a patch.
Monking.
 
StackOverflow's focus is on software that doesn't work -- where you have a specific problem. Questions about how to improve working code are more likely to be topical on our sister site Code Review. — Charles Duffy 10 secs ago
 
 
I upvoted that question at some point...
but I'm swamped for the remainder of the month, so if you want to take it, don't hold back :)
 
But please provide a link to this code. Lets see it. Lets review it on codereview.stackexchange.comMartin York 17 secs ago
 
5:05 PM
0
Q: Word Search Algorithm

AriefI have a Word Search algorithm, the main function (wsearch) takes a grid of letters as an input and a 'word' to search for. The output is the number of occurence of the 'word' in the grid. First, I break down the problem into three functions (including wsearch). 1) The nword is for looking the ...

 
5:23 PM
@Zeta Sounds like fun
So if I replace the WPF component with a WinForms component then I have a whole other headache, yay
Basically our application can have multiple GUI threads and the webbrowser control in WinForms has one thread and you can join that one up with one GUI thread
The WPF variant however is hosted within its contained ElementHost and therefore doesn't care about anything else and will happily work
 
 
1 hour later…
6:29 PM
@geza Sure you can compare two things that do completely different things and compare them and the one that does nothing can definitely be ten times faster than one that does something. That's easy. If you can time something that takes 10ns accurately I would love to see your benchmarks. Lets review the code to see where it is going wrong. codereview.stackexchange.comMartin York 8 secs ago
 
@Mast does the gifv display inline in your post?
7
Q: A Structured FizzBuzz

MastWarning Wall of text, little bit of code. This question is about as much as introducing the language as it is about whether or not I still know how to write the language. Introduction Programmable Logic Controllers (PLCs) are industrial, heavy-duty computers used to control (semi-)automated ...

obviously I can click the link to open it in a new tab and see it there
 
@SᴀᴍOnᴇᴌᴀ Why @Mast
 
@JoelBerkeley Maybe your question should be in codereview. You already have a working code and want to improve. — Gabriel just now
 
@skiwi are you asking me why I mentioned Mast, when citing a Mast post?
 
I'm voting to close this question as off-topic because it belongs to Code Review SE and Loreno (OP) re-asked there. — Nikhil Vartak just now
 
6:40 PM
@SᴀᴍOnᴇᴌᴀ No, I was asking @Mast why he'd ever do such a thing :P
 
oh okay... that way my other thought...
IIWY I would have used the dear God, Why?? emote: щ(゚Д゚щ)
 
@NikhilVartak it doesn't appear Loreno has asked on CR since 2016... did you mean OP should re-ask there (not past-tense)? — Andrew Elliott 36 secs ago
 
@SᴀᴍOnᴇᴌᴀ lol that one is awesome
 
possible answer invalidation by user236945896 on question by user236945896: codereview.stackexchange.com/posts/204394/revisions
 
6:58 PM
0
Q: Pentominoes in Python

LouisonoI'm currently coding a game of Pentominoes and I would like to hear suggestions on how to improve my code and make it more pythonic. Rules and goal of the game There is an 8x8 grid and you have 12 pentominos. The goal of the game is to lay all the pentominos on the grid without any overlapping,...

 
7:10 PM
As I said above doing nothing is always much faster than doing something. If you want to show me something then write it and put it on codereview.stackexchange.com lets get it reviewed. This talking in comments is getting us nowhere. You are making arguments about hypotheticals code you can't or wont share or snippet straw man code examples that can't be tested and seems very much like broken code. But lets get it reviewed. Lets have a real discussion. Put the code on codereview.stackexchange.comMartin York 20 secs ago
@MartinYork: Can't be tested? Copy it into a file, compile and run it. You've said: "If you can time something that takes 10ns accurately I would love to see your benchmarks". There you have it. That little snippet does exactly that. Please, check it out. And after that, if you did, and you still think that my little snippet is wrong, then I promise I'll put it into codereview. But I don't want to put it into codereview for nothing. (I.e., you haven't really checked it, as "can't be tested" is clearly wrong). — geza 59 secs ago
 
7:30 PM
possible answer invalidation by Zathorix on question by Zathorix: codereview.stackexchange.com/posts/204396/revisions
 
@Duga rolled back
 
@geza Now your just trolling (or trying to make me laugh). There is no point continuing here in the comments. I await some real code in codereview.stackexchange.com so we can continue the discussion there. — Martin York 1 min ago
 
@Duga (-‸ლ) much discussion in comments ...
 
0
Q: Does this little snippet measure speed of `dynamic_cast` correctly?

gezaThere is a question here, which is about a faster alternative of dynamic_cast. There is a discussion under the answer by Martin York, where he said: If you can time something that takes 10ns accurately I would love to see your benchmarks I've written this little program, and it runs in 8 s...

 
8:02 PM
-2
Q: Increase the power of tesseract

James LockI'm working on a project to identify images, however, I'm not getting 100% in my analyzes with tesseract ... is there anything I can do to increase the success rate? pictureBox2.Image.Save("image.bmp", System.Drawing.Imaging.ImageFormat.Bmp); var engine = new TesseractEngine(@ "./tessdata", "...

 
Hello
I have some awful code but I am not sure how to make it better
It works
I'm not allowed to use Math class.
 
8:18 PM
@JBis Why don't you ask on the page? That way you can reach more users.
By the way, it doesn't work. It returns the wrong result for exp(2, -1).
@Vogel612 Maybe in ~10 days or so. I also upvoted it in late August, but I was exhausted from Gamescom back then.
 
@Zeta exp doest work for negative numbers
That was just there for reference
Heres the code in question: return (Integer.parseInt(String.valueOf(String.valueOf(theFinal - (int)theFinal).charAt(2))) >= 5) ? (int)++theFinal/exp(10.0,b) : (int)theFinal/exp(10.0,b);
@Zeta May do thanks.
 
@JBis Well, then it returns the wrong result for exp(-2, 1).
 
See edit :)
 
Ah. In general for negative numbers.
 
Its not a bug, but a feature XD
 
8:25 PM
negative exponents should be pretty straightforward.. just calculate the positive exponent and then get the multiplicative inverse
 
Either way, I'm off. Make sure to read the usual help section before you ask your question, and keep in mind that your question should contain a short description. If you have an assignment at hand, give a summary of the assignment. That way improvements will still be relevant to you.
 
uhh... put one over the result
 
yeah just realized its supposed to work with negtives (as a)
 
Heh. That's almost already done. The ternary operator uses the wrong expression, though, and the for loop needs an abs.
I'd use the double-and-add method to keep the runtime O(log |b|), though. But not sure whether runtime is part of the assignment.
TTGTB. Gniknom!
 
@Zeta Isnt x^-2 == 1 / x^2?
And where do I need abs?
 
8:37 PM
@JBis Hints: test your code with exp(2, -1) (should be 1/2, but your code returns 2) and exp(-2, 1) (should be -2, but your code returns -1/2).
 
arrow-up to edit your last message for ... 3 minutes IIRC
 
9:07 PM
0
Q: Group by example matching elements in lists

Anonymous3.1415Trying to group elements in a list by the their last element. I think this is a good problem to use groupby() from itertools. Here is my solution: from itertools import groupby def match_ends(list1): """Returns a dictionary of groups of elements whose end elements match Returns empty...

 
9:39 PM
0
Q: Printing Right Triangles Recursively in Haskell

Grayson CroomI've implemented a simple program to print out 4 right triangles oriented in different ways to learn Haskell. I'm sure there are more efficient ways of doing what I have done, and I just want some feedback. All feedback related to the efficiency or quality of my code is welcome. The four differ...

 
9:50 PM
possible answer invalidation by geza on question by geza: codereview.stackexchange.com/posts/204426/revisions
 
10:44 PM
0
Q: Count number of disparate characters in two strings in C++ v/s Python

db18In Python, I've a simple code as this: strcmp = "SOS"*int(len(s)/3) return sum ( s[i] != strcmp[i] for i in range(len(s) ) In C++, I implement this as: int count = 0; int slen = s.length(); string foo; for (int i = 0;i<slen/3;i++) foo = foo+"SOS"; for (int i=0;i<slen;i++){ if (foo[i]...

0
Q: 10 minute Tic Tac Toe

QuintecAfter seeing Snake coded in 10 minutes, I decided to try a similar challenge, albeit easier. The following is Tic Tac Toe that I coded in 10 minutes. Given the short time frame, I'm sure there are style and convention errors abound, and would appreciate any suggestions :) I will also specifical...

 
11:00 PM
0
Q: prime number segmented sieve

Devina Muljonoi tried to solve SPOJ prime number problem. the code produced correct result, but Time limit exceeded and also memory need around 970M which is not efficient(?) what makes my code slow and how can i optimize this code under time constraint around few seconds? thanks! problem: Peter wants to ge...

 

« first day (1971 days earlier)      last day (2037 days later) »