« first day (2606 days earlier)      last day (1419 days later) » 

12:00 AM
RELOAD! There are 6771 unanswered questions (89.8821% answered)
 
12:48 AM
0
Q: Faster binary search to find the index in Python?

LnzI am implementing a binary search algorithm and my code is as shown bellow: def binary_search(a, x): left, right = 0, len(a) ...

 
1:33 AM
@ADyson is talking about Code Reviewpppery 38 secs ago
 
1:57 AM
1
Q: Python - A Numeric Matrix Calculator/Processor

DeltaHaxorit's the second object oriented program i've worked on, more details on https://hyperskill.org/projects/96?goal=391. I've added as much documentation as needed, as a first time, to explain each component. class Matrix: def __init__(self, dimension, elements=None): """ Use: ...

 
2:21 AM
1
Q: Folder Syncer in Python

Unsigned_ArduinoI have made a script that syncs one folder to another. So if, for example, you saved some changes in a file in directory A, then that file would have the same contents om directory B if you set it up. It runs on Python 3 and the watchdog module. If you are wishing to try it out (and please do), m...

 
 
1 hour later…
3:37 AM
Please note the existence of Code Review, a site dedicated to reviewing working code with the intent of improving it. Critically, read this before asking: codereview.stackexchange.com/help/how-to-askmsanford 32 secs ago
 
4:04 AM
@pacmaninbw If it's someone trying to work around the system, it's definitely flag worthy. The moderators have tools to figure it out.
I think Jamal is/was particularly good at catching sock-puppets, voting rings and the like.
@CaptainObvious One more VTC
 
4:40 AM
0
Q: Python,diffuculty with json list

katie03#def update_transactions(file_path: str, transaction_list: list): """ You are part of a team tasked to create an application that helps bankers by saving their transactions for them. Your job within the project is to implement the feature that actually saves the transactions to the hard drive. Th...

 
5:04 AM
0
Q: Solution of class design issue of generic of restricted type

user366312Check this problem. I have devised the following solution: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IDataTypeeeeeeeeeee { public interface IDataType { object Add(object other); void SetV...

 
5:40 AM
Monking
 
6:02 AM
@Peilonrayz Was surprisingly simple really. There was another piece of code that looked a heck of a lot like another piece of code and the actual code that threw the error wasn't properly wrapped.
No spookyness, just a case of the Friday.
 
6:42 AM
If your code works and you're just asking us to review it, you should post it over at Code Review instead. — Magnus Eriksson 1 min ago
 
7:00 AM
0
Q: What is the best way to use serverside validation in PHP PDO?

user9437856I have a form on my page. I am using jQuery validation for client-side and PHP for server-side validation. I am using PDO. I don't have any issues with client-side and server-side validation. My form is working. I want to know that is this code is the best code with serverside validation with log...

 
7:23 AM
0
Q: React programming pattern

kirill .zI create https://github.com/storenth/react-redux-todo and ask to review my Todo-react-app for programming pattern: dividing components into presentational components and container components. Here’s the basic idea behind it: if a component has to have state, make calculations based on props, or m...

0
Q: Reusable, robust c++ std::hash<mpz_class> for GMP's big integer type

Daniel S.1. Goal My intention is to provide a fast hashing algorithm to hash GMP's big integer type mpz_class and mpz_t so I can use these types as keys for an unordered_map. The code shall be reusable for others. cf. my stackoverflow question about this topic 2. My Approach I've written the C++ glue cod...

 
7:40 AM
Monking
@Mast Ah, that sounds nice enough :)
 
8:09 AM
0
Q: Avoid code duplication if what changes is one argument type only

Fred HorsAs you can see these functions differ only in keys []int and keys []*int (and in name). func (db *myDB) QueryWithKeys(keys []int) ([]*models.Player) { var players = make([]*models.Player, len(keys)) _ := db.Model(&players).Where("id in (?)", pg.In(keys)).Select() // several other equal co...

 
8:26 AM
@Peilonrayz One of the problems with accessing the same 'dangerous' data in 2 places.
But it's looking a whole lot neater than the original did, so, meh, can't have it all I guess.
 
8:56 AM
0
Q: How to remove all sub paths?

Aleksey TimoshchenkoI am a new in C++ (and I think there is should be much shorter way to do what I need), but what I need to do is: I have a vector of paths to folders C:\\Sessions\\MyFolder C:\\Sessions\\Calib C:\\Sessions\\Calib\\2020_04_30_18_02 C:\\Sessions\\Calib\\2020_04_30_18_03 C:\\Sessions\\Calib\\2020...

0
Q: Please explain this code to me

MohitI'm new in coding, Please can someone explain this code to me in simple language so I can understand it better. int activePlayer = 0; //0:represents yellow 1:represents red 2:represents empty int gameState[] = {2,2,2,2,2,2,2,2,2}; int winningPositions[][]={{0,1,2},{3,4,5},{6,7,8},{0,3,6},{1,4,7}...

 
9:14 AM
@Mast I tried to have it all, it just makes an unmaintainable mess. :( DRY only goes so far
@CaptainObvious No
 
10:05 AM
possible answer invalidation by Vogel612 on question by Emma: codereview.stackexchange.com/posts/244286/revisions
 
@Duga was wondering when you'd finally come nagging :)
 
Also, there are lots of good existing Q&A on [python] OOP decomposition (e.g. for games), both here and on CodeReview.SE, please look through them, they will answer you. — smci 56 secs ago
 
10:31 AM
0
Q: Reading one source Stream by multiple consumers

aepotThe problem was using single Stream from the HTTP response in multiple consumers simultaneously. For example: while data is loading, I want write it to the some cache file and deserealize it at the same time. This code will not work for obvious reason. But it represents some desired things. priva...

 
FYI, there is Code Review which is appropriate for this kind of question. — Pac0 37 secs ago
 
10:55 AM
0
Q: If/else produce code duplication

hsadikI have the following class: public class UpdateData { public static boolean updateHasMessage(Update update) { return update.hasMessage() && update.getMessage().hasText(); } public static boolean updateHasCallbackQuery(Update update) { return update.hasCallbackQuery() &&

 
@Duga @Vogel612 Is that overexchange in disguise?
9 questions in 7 days.
 
Become a mod in the next elections and find out?
Overexchange was actually able to not generate that much controversy with their questions, so I doubt it
 
@Vogel612 Foreshadowing?
 
@Vogel612 Style is different too.
The remark was in jest, although there definitely are similarities.
 
11:10 AM
@Peilonrayz not particularly, no
 
Just not enough.
 
@Vogel612 Nice ^^
 
@Vogel612 Already looking forward to me and Peilon slugging it out in the next round.
 
@Mast I'm sure you'd win that competition :)
 
@Peilonrayz I'm not so sure. The results of last time were hardly conclusive. My lead wasn't that much and the network has changed. Besides, your 'moderator score' is a lot higher due to your higher reputation, and that tends to attract votes.
 
11:29 AM
@Mast Wow, 11k rep is making you only have a score of 29 rather than 38. That moderator score is really bad
As in the mechanism not your moderator score
 
I know.
According to the system, I should post more questions just to fix that.
 
Yeah that's not what moderation is...
 
Exactly.
Half of the moderator score is determined by reputation. Which is activity, not moderation.
But hey, no system is perfect and this is the one we have to deal with. It's not the biggest problem the SE network has today.
Besides, there's worse things in life than losing the election to you.
I'd just have to win the next one, 3-5 years later.
;-)
 
11:53 AM
@Mast Took the words right out of my mouth ;)
 
12:06 PM
I have oneaepot 27 secs ago
 
-1
Q: Getting wrong answer in my C++ Merge Sort logic. Can anyone look through it and point out where I am wrong

Tarun Singh Getting wrong ouput : 0 0 0 0 0 0 0 2 I am unable to get the correct output. I think my logic is correct but there's tiny some mistake which I couldn't find out. #include<bits/stdc++.h> using namespace std; void merge(vector<int> &left,vector<int> &right,vector<int> &v){ int m=l...

 
I would say this question is more appropriate for codereview.stackexchange.com. — Guru Stron 32 secs ago
Yet another solutionaepot 11 secs ago
 
12:30 PM
0
Q: Javascript improvement suggestions of a begginer's code

mister nobodyAs a beginner coder in js, I'd like to hear about further improvements of the following code, but nothing too advanced, please. The next is a program that is meant to work the following way: A user inputs a color array like this one: ["blue", "green"] The code checks if those words are valid inp...

 
Monking
 
Monking
No description
 
12:45 PM
@Mast I can only VTC once.
 
@Mast Sorry, it's not UWYA to me. :(
 
I considerably simplified my list implementation, to the point that one might wonder what was difficult
6
 
@Morwenn It is always easier to clean up the code after it is implemented. You are no longer trying to figure out how.
 
That's true
Also after just a bit of reading I realized that the sentinel node could actually be used to guard both sides of the list, which somehow didn't occur to me before
This massively simplified the insertion mechanism
 
Reading your own code, or an online article?
 
12:57 PM
Online articles about linked lists
I also managed to use an union to inhibit the construction of a data member first the first time
 
Maybe CodeReview is a better site for this question. — Alex_P just now
 
1:15 PM
@Peilonrayz After the edit it's much better.
 
@Mast Oh, what timing. Yeah I agree Rev1 UWYA
 
it's so enjoyable getting my Spagetti code fixed in an instant
 
I’m voting to close this question because it belongs on code review (codereview.stackexchange.com) (with the proper edits made to be a good question there) instead of on SO — Remy 53 secs ago
If you've got working code that you just want peer reviewed for improvements, your question should be asked at Code Review instead; that's the exact reason that site exists. This site is for questions about non-working code. — Ken White 51 secs ago
 
2:06 PM
0
Q: What does this double iteration do/mean in this code?

Austin EckelI came across this code on edabit: def group(lst, size): from math import ceil d = ceil(len(lst)/size) return [[lst[ii] for ii in range(i,len(lst),d)] for i in range(d)] What exactly are the two instances of "ii" doing in the final line? Is there a specific term for this? Is "ii" two...

 
2:25 PM
This also might be a good question to ask on the code review stack exchange. — Calvin Godfrey 54 secs ago
 
I'm probably not going to ask a question with my linked list implementation because I only implemented a few functions since I didn't need all the other ones
 
There are MANY ways to implement linked list, as with many other data structures. Some are more efficient in speed or memory usage than others. As long as yours passes functional tests, you're good. There are other sites that offer code review etc. if you want suggestions. Somebody may pop one on here. — Jeff H just now
 
Thanks for being relevant Duga
9
 
2:46 PM
lol
 
Monking
 
Monking
 
Monking
 
3:03 PM
@Morwenn Perfect timing Duga, @SimonForsberg.
 
@Morwenn @pacmaninbw @Duga just assumes everyone is talking about linked lists, all the time.
 
Hehe
 
LOL
@CaptainObvious I don't think this needs any more down votes, but it should be closed.
 
3:17 PM
0
Q: Dijkstra algorithm c#

user10776032I've tried implementing a simple dijkstra algorithm in C# and found it really confusing and not 100% if I've implemented it correctly. Could this be more efficient? Any pointers, does it need to be modified? using System; using System.Collections.Generic; using System.Linq; using System.Text; usi...

 
@CaptainObvious There is an array that is used, but the array is never declared.
 
3:41 PM
0
Q: I am finding errors in the code although tried to remove many are they still there?

Muhammad BilalThe problem is that visual studio 2019 is giving plenty of errors since I have checked and although probably many of lines are given red class Test { private: int x; public: Test(int x = 0) { this->x = x; } void change(const Test &t) { t=t.x; } void print() { cout  << "x = " <<...

0
Q: "jedi's riddle" problem optimization

picusViridisthe problem could be found here. basically, i need to find "i" from z[i] = z[i-1] * a % n = 1. i've written a simple code, but it's too slow. import math def solution(a, n): if math.gcd(a, n) > 1: return 0 z = 1 i = 1 while True: z = z * a % n if z == 1: ...

 
3:58 PM
Monking
 
0
Q: How to properly design solutions where encapsulated strategies/apis may need to maintain state and communicate with one another?

cubesnycI am designing an application whose main function is to trade cryptos across different exchanges. I have defined Exchange as one of my core domain objects, with two public methods that revolve around order placement, one that gets the price for something of interest, and one that places an order ...

0
Q: Renaming and deleting video file

Android DeveloperI am using below code to rename and delete video. Need review for the following: 1.Code optimization 2.Performance 3.Overall code review renameVideo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int index = fileP...

 
@pacmaninbw I done hammered it
 
Thank you guys! I will consider to put this question on Code Review. It is true Chris Charley, I have a problem with my code, I will check this point and then I will put it on Code Review, thanks! — Hanzel Godinez 26 secs ago
 
4:15 PM
@SᴀᴍOnᴇᴌᴀ That you did.
 
@pacmaninbw nine
...total ... I would guess if it wasn't a HNQ it might have only gotten 1-2
 
Check out our sister site Code Review for a place to get feedback for working code. — Code-Apprentice 58 secs ago
Not sure why the "belongs on another stackexchange site" flag doesn't include codereview, it seems questions of this nature are asked pretty often — MLarionov 19 secs ago
 
Another example with 23 occurrences within three seconds — Sam Onela 10 mins ago
 
@Dinero I posted an answer, but you might get more detailed feedback at CodeReview. — Code-Apprentice 49 secs ago
 
Very Punny?
 
0
Q: LeetCode 200: Number of Islands

EmmaI'm posting my C++ code for LeetCode's Number of Islands. If you have time and would like to review, please do so. Thank you! Problem Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands hori...

 
@SᴀᴍOnᴇᴌᴀ More a play on @Vogel612 comment on this.
Hope you had a good father's day, I noticed you weren't around yesterday.
 
Yes it was good - got to hang out with the family, go for a little bike ride...
I typically don't come on to chat on the weekends
 
Yeah, it's pretty quiet here on weekends.
 
possible answer invalidation by Vishesh Mangla on question by Vishesh Mangla: codereview.stackexchange.com/posts/243939/revisions
 
4:50 PM
@Duga Rolled back.
@SᴀᴍOnᴇᴌᴀ Not even a record, apparently.
 
@chepner You may have looked at that link I mentioned for Mlarionov but in case not please see [Migration of code questions from Stack Overflow to Code Review](Migration of code questions from Stack Overflow to Code Review) — Sᴀᴍ Onᴇᴌᴀ 15 secs ago
 
@Duga fiddlesticks! I messed up the URL for the link... but at least I saw that before closing the tab... and fixed it
 
5:08 PM
@SᴀᴍOnᴇᴌᴀ I was interested in what the largest amount of hots we've had. And we have one with 31 ;)
 
@Peilonrayz Global warming.
2
 
31 often makes me think of the song "Pretty Fly (for a White Guy)" because of the lyrics "He asked for a 13 but they drew a 31"
 
Python curses is legit y'all
 
The CLI library thing?
 
5:11 PM
Yeah
 
Never used it, might have to give it a go
 
@Peilonrayz ^^^ Made that over the last hour
Literally about an hour
It's a live virsh monitor
Shows me VM's + status and networks + status
Updates every second so I can leave it doing it's thing like htop
 
That does look quite nice. That's pretty cool :)
Is that using your terminals colour scheme?
 
Since this is all working, you may do better posing on the Code Review StackExchange site. — hardillb 7 secs ago
 
5:19 PM
@Peilonrayz ^^^ ;)
 
Greetings, Programs.
 
When I saw your theme the other day I thought it did look very nice. I'm conflicted if I should switch, I like mine too >:(
Greetings
 
5:41 PM
0
Q: LeetCode 375: Guess Number Higher or Lower II (Dynamic Programming)

EmmaI'm posting my C++ code for LeetCode's Guess Number Higher or Lower II. If you have time and would like to review, please do so. Thank you! Problem We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to guess which number I picked. Every time you guess ...

0
Q: Why does this C code behave this way? Isnt the ++ operator supposed to increment the value?

user2277550#include<stdio.h> #include<stdlib.h> int printarr(int a, int b, int c) { printf("\n %d %d %d \n",a,b,c); } int main() { int arr[]={10,11,12,13,14}; int i1=1; printarr(arr[++i1], arr[i1], arr[i1]); int i2=1; printf("\n %d %d %d \n",arr[++i2],arr[i2],arr[i2]); return 1; } OU...

 
6:08 PM
@DerKommissar Yes, it's awesome. Unfortunately I've never found a good excuse to make something beyond a Hello World app.
I don't do much monitoring.
 
6:20 PM
@Mast Eventually™ I'll make this more than it is, but only as I need it to be more.
 
@DerKommissar Nothing wrong with over-engineering :-)
 
I'll over-engineer when I need those bits, I figure.
Right now, it has everything I need.
Added storage pools, and I think it's perfect for what I'm doing now.
 
@DerKommissar Shiny.
 
1
Q: Reduce Sensor Messaging Noise to MQTT

weird.turned.proI'm running MicroPython on an ESP32 relaying sensor data to my MQTT server for Home Assistant. I only want it to emit a message when state has changed and a motion detected state to hold for a minute before returning to a clear state. I see a lot of examples using sleep, but I don't like the bloc...

 
Yep
Getting there
My automation scripts are working quite well as well.
 
6:37 PM
@DerKommissar I just love the colors!
what magic is that ?
best I could do was a bash prompt colouring so that I can find my last command..
 
2 hours ago, by Der Kommissar
Python curses is legit y'all
 
> open-source curses library hosted on Linux
yes please! I need some variety.
 
6:53 PM
0
Q: How can I simplify this JQuery validation process?

John BeasleyHow can I simplify this functioning JQuery validation process: class UserEdit { addUser(uobj) { $('#loadingDiv').show(); if(uobj.adduser == "" && uobj.addfullname == "" && uobj.addemail == "" && uobj.addlevel == "") { $('#loadingDiv').hide(); $('#adduserError').show(...

 
7:06 PM
Monking
 
Monking
 
@ankii Colors are Nord theme for iTerm2, the bottom right panel is one I built with curses for Python 3.
 
7:29 PM
@CaptainObvious Why isn't that closed yet people?
2 more VTC please.
 
@RMunroe Mathematics: the science that blatantly states they can do whatever they want.
And carries on like they can.
 
The on-hover is pretty funny
 
@DerKommissar awesome, thanks! I'll see if it can bring me closer to CLI
 
0
Q: LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers

EmmaI'm posting my C++ code for LeetCode's 1320. If you have time and would like to review, please do so. Thank you! Problem You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for example, the letter A is located at coordina...

 
7:40 PM
@ankii There is a LOT of stuff in there, I've only scratched the surface.
Also the curses.halfdelay is amazing.
It basically let's you create a time-repeat script that will immediately return on input.
So it waits for either the time to expire, or a key input.
 
@DerKommissar most of the time I just change code, run the app, test and repeat.
nothing to monitor an ongoing process with curses
iterm is what is on my todo list
If I update it to Catalina, I'll give zsh a try
they have a nice theme community too
 
@ankii This is more along the lines of curses makes it relatively easy to build something akin to top, for example.
 
:o
 
You can create windows and panes that you can update "in real time" so that you don't need to rerun a command all the time.
I'm using it to keep tabs on VM's on a server I have, so that when I start VM's up I can see them in my list immediately.
So it's running virsh list --all, virsh net-list --all, and virsh pool-list --all and then formatting the output into a CLI table.
 
hmm memory usage and disk write speed is something I'd like to keep an eye on
to catch memory leaks or avoid filling the disk too soon.
 
7:48 PM
So quite-literally all I do is sudo ./virsh-monitor and it starts and just hangs out.
 
now I have to jump tabs in activity monitor
 
Yeah, I am remoting into a server so it's nice to have this constantly feeding
 
@ankii If you're currently shell-hopping then also give fish a try.
 
8:04 PM
1
Q: how to destructure this.props react js

Matheus MartinsI'm try create a component that receives an array and this component is gonna show a list with props data const Mesas = [{ id: 1, valor: 500, produtos:['COCA COLA', 'FANTA'] },{ id: 2, valor: 100, produtos:['PRATO1', 'PRATO2'] }] const App = () => {...

0
Q: Do you know of a better way to parse XML data and update values of each nodes children?

William HumphriesThe code below iterates through the nodes of an XML file and updates values based on a Regex expression in the 'rule' child node from an XPath expression. XML is included at the bottom. Can you think of alternatives to this approach? Is there a LINQ approach to this you might favor? using Syste...

 
@Zeta hmm that is a manageable leap from something known to something better unlike zsh: something unknown
thanks!
and good night too!
 
possible answer invalidation by user9437856 on question by user9437856: codereview.stackexchange.com/posts/244305/revisions
 
@Duga Rolled back.
 
i would recommend going over to the code review sister site of SO and postign some code etc. They will be a great resource for you with this type of question. codereview.stackexchange.combic 9 secs ago
 
TTGTS 😴. gniknoM!
 
8:25 PM
I’m voting to close this question because it probably belongs on the Code Review Stack Exchange site. — Mark Setchell 19 secs ago
possible answer invalidation by Mast on question by Ch Na: codereview.stackexchange.com/posts/244208/revisions
 
@Duga Looks fine. The first level of indentation was changed from 5 to 4, but meh.
 
@Peilonrayz Smelled like a copy-paste mistake. I'm not convinced the question shouldn't be closed for lack of context by the way, but it has been answered and I don't feel strongly enough about it.
 
@Mast Yeah both of those points are understandable. The lack of str2datetime makes it kinda pointless to review
 
I love that you're all still trying to help random people ^^
7
 
8:52 PM
0
Q: LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers II

EmmaI'm posting my Python code for LeetCode's 1320. If you have time and would like to review, please do so. Thank you! Problem You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for example, the letter \$A\$ is located at ...

0
Q: Practicing parsing HTML file

guestI am a math tutor and I found the site https://www.yksityisopetus.fi/ where one can search pupils. I tried to do a Python parser to find pupils that wants math teaching with at least 25 €/hour. Is there any improvements for this code? import requests import tkinter as tk link = "https://www.yksi...

 
@Mast closed now
 
9:40 PM
-1
Q: Tic Tac Toe - Function output issue

Azzaria BNeed to get an input of XOXO from the last function until test_board list is full (9 entries). Output currently XXXXX or OOOOOO What is wrong with my code in def place_marker? Display board function - formatting for Tic Tac Toe layout from IPython.display import clear_output def display_board(bo...

 
10:05 PM
1
Q: OOP Based TicTacToe - Logic Improvement/Best Practices

AustinLooking for any feedback to improve practices on the following logic, and I have removed large chunks of documentation to reduce noise. I feel the areas that could expect heavy criticism are the win/tie condition checking. Main.cpp #include "Board.h" int main() { //initialize board Board...

 
@Alex_P please don't suggest Code Review unless you know the post would be on-topic. Please read the CR help center pages like 'What topics can I ask about here?' and 'How do I ask a good question?_". — Sᴀᴍ Onᴇᴌᴀ 48 secs ago
 
0
Q: Why is my (attempt) of quicksort getting RecursionError?

revliscanoI was playing around with sorting methods, brushing up on my algorithms. I have made the following implementation of quicksort: def quicksort(l): def inner_qs(list_, start, end): if end - start > 1: piv = list_[end - 1] aux_index = start for i in r...

 
@CaptainObvious RBA
 
10:41 PM
@CaptainObvious original post mentioned recursionerror - the error is no longer mentioned but the code didn't appear to change... just code to measure removed...
ಠ_ಠ not sure if still working...
 
 
1 hour later…
11:43 PM
This question is asking for a code review, which may be on-topic at codereview.stackexchange.com - please consult their help center before posting, though. — Ryan M 48 secs ago
 
11:54 PM
If you have working code that you're looking for help improving, you should ask at Code Review instead - that's the entire reason that site was created. This site is for problems you're having with non-working code. — Ken White 17 secs ago
 

« first day (2606 days earlier)      last day (1419 days later) »