« first day (2139 days earlier)      last day (1879 days later) » 

12:00 AM
RELOAD! There are 5866 unanswered questions (89.9443% answered)
 
0
Q: Python - SQLite3 account creator

J.PeggyThis program allows users to create and log into their account. The database is created using SQLite3 and the GUI is just simple tkinter boxes. So I just want to know how to improve my code, organise it, make it more efficient. Any other advice would also be great, thanks. Thanks. import sqlit...

 
12:58 AM
Mark, are you still there? If so, would you mind doing a code review for us over in Node world? Or actually, just drop a note at GitHub here github.com/nodejs/node/issues/26603#issuecomment-472236941 The node team in inferring inflate() returned Z_STREAM_END if there is input left to consume yet no output is generated; So they're assuming for every input byte an output byte will be generated and flushed. Is that true? — Christopher King 58 secs ago
This looks like a codereview.stackexchange.com question. — jaco0646 56 secs ago
@jaco0646 This is clearly example/stub code and so is off-topic on Code Review. Please don't recommend sites if you don't know their rules. — Peilonrayz 55 secs ago
 
1:18 AM
0
Q: 2D Finite element code that creates a mesh for voltage distribution [MATLAB]

Lil_TEEI am trying to create a finite element code that describes the voltage along a coaxial cable. I have pasted an image of where the boundaries are located but I do not think you need to know much about the finite element method. Here is the code: function FEM2D % % This function demonstrates how ...

 
1:29 AM
I think this is a better fit on Code ReviewAmy 37 secs ago
@Amy I see where you're coming from for the css bit, but the potential answers may also recommend jumping to a different tech altogether e.g. CSSOM - or propose an alternative solution. Is that under CodeReview's remit? — andyhasit 57 secs ago
 
 
2 hours later…
3:54 AM
Ideally, your source control system should require code review for promotion to master; what kind of sdlc are you following here? — Elliott Frisch 17 secs ago
 
 
1 hour later…
5:04 AM
I suggest that you start a new question and post the code that you are using to do that. Try to explain very clearly what you are trying to accomplish. It might be better suited for codereview.stackexchange.comJerry 44 secs ago
 
-1
Q: why isnt my caesar cypher working in python 3

James ChapmanMAX_KEY_SIZE = 26 def getMode(): while True: print('Do you wish to encrypt or decrypt a message?') mode = input().lower() if mode in 'encrypt e decrypt d'.split(): return mode else: print('Enter either "encrypt" or "e" or "decrypt" or "d".') def getMessage...

 
5:24 AM
Monking
 
5:36 AM
Monking.
 
5:49 AM
0
Q: Python: parallel code running slower than sequential version

shaifali GuptaI have a sequential code where I am counting unique events occurring at a timestamp given the data on time intervals. The sequential code I have prepared is: a=list of timestamps of size 100. number=[] for i in range(100): indices=numpy.argwhere((a[i] >= dataset[:,0]) & (a[i] <= dataset[:,1]...

 
6:36 AM
Monking
 
7:35 AM
possible answer invalidation by rsm on question by rsm: codereview.stackexchange.com/posts/213510/revisions
 
@Duga Looks ok, but that question is kind of a mess.
 
0
Q: Find If One List Is A Subsequence of Another

Tobi AlafinSo the problem of verifying if a list is a subsequence of another came up in a discussion, and I wrote code that seems to work (I haven't rigorously tested it). IsSubequence.py def is_subsequence(lst1, lst2): """ * Finds if a list is a subsequence of another. ...

 
8:04 AM
0
Q: Load all data from cursor

Oleksandr AlbulI have Db table: 'aid' INTEGER, 'tid' INTEGER, Which represents connection between activity and task, so multiple tasks could be connected to one activity using their ids: aid tid 1 5 1 9 1 11 So activity with id=1 is connected with tasks with ids=5,9,11. I load all this data during ...

 
8:24 AM
0
Q: On change checkbox show/hide function

AnkiThe function works fine, but not looking good or right to me. It is not good practice to write such long code for a small function, I don't know how to optimize $('#idname').each(function() { var $this = $(this); var $row = $this.closest('.form-row'); var $parent = $row....

0
Q: Short analogue of Riffle[] accepting two blocks

NakilonImagine that I have an array of some elements that I need to loop through (i.e. execute some block A on each element) but between them I have also to "clean up" (block B) from the previous iteration and that I don't need to clean after the last iteration because B is slow and it is done somewhere...

 
8:50 AM
possible answer invalidation by Miguel 2488 on question by Miguel 2488: codereview.stackexchange.com/posts/215255/revisions
 
9:02 AM
0
Q: PHP Class used in Drupal 8 module

John CoganI've written a module whose purpose is to allow a user to simply add their email and click 'Save Search'. The details of the search are stored in two straight MySql tables which are not in any way related to the rest of the tables which are used by Drupal. The class is close to complete (Dotmail...

 
Monking
@Mast I didn't get your comment, can you elaborate what you mean? I think it's pretty readable as a comprehension with slicing, but I might be biased :)
 
9:21 AM
return any(
    haystack[i:i+len(needle)] == needle
    for i in range(len(haystack) - len(needle) + 1)
)
It's nice and succinct and all, but it isn't it a bit much to do all in one return statement?
There's quite a lot happening there and at first glance it didn't make sense to me. Took quite a couple of glances actually, before I understood why this actually works.
 
I'd argue that refactoring questions are a better fit for Code Review.SE than Stack Overflow — Michael Dodd 27 secs ago
 
Does that explain it better @Ludisposed
?
 
It does, but I kindly disagree :) Slicing, any and range are all pretty common Python keywords. And I don't think there are too many operations in that return statement but YMMV
 
9:48 AM
@Ludisposed Fair enough
 
@Mast I'm interested in in how would you would suggest writing it
 
IIRC, that's even one of the canonical answers on SO.
Although canonical answers on SO are sometimes weird.
 
@Zeta We were talking about a CR answer.
@Peilonrayz Yea, I'm interested in that too. The more I think about it the more I suspect it's not that bad. Hence the idea of leaving a comment above it and leaving it as is.
 
@Mast I know, but if you search for "how to find subsequence in python", you will hit stackoverflow.com/a/3314913, which is basically, what Ludisposed wrote.
 
It's most definitely not bad code. It's very pretty. But it took a while for me to understand why it worked.
I didn't propose a rewrite, I proposed a comment.
That's all.
I'd link to the original comment, but I had just removed it after our exchange...
 
9:56 AM
@Mast Fair :) You may not have the pattern matching recognition that others do to read it quicker. I personally find it fine, and think a comment is on the level of primes = [0] * n # build list of numbers to find primes.
 
I'm on the same boat as @Peilonrayz, I think a comment would only add noise.
 
And I can definitely see where you all are coming from on that.
Let's just blame it on the difference in experience :-)
 
@Mast Do you know if we've had a Meta discussion about people that post questions but don't seem to care too much about half the content of answers?
 
@Peilonrayz Like repeatedly making the same mistakes? Even though it is mentioned multiple times...
 
@Ludisposed Yeah
 
10:07 AM
7
Q: Users that appear to learn nothing

Ethan BierleinI've run into a user's questions a couple of times now, and I'm finding that they seem to make the same mistakes in each question they post, like using namespace std;, or system("PAUSE");. The user mentions that their professor requires these bad habits, so this is a little bit of a different ca...

That?
I'm still hoping canonical answers become a thing.
 
Yeah that's probably it, so just pretend they've not posted on CR ever before. :/
 
@Peilonrayz Or don't review it, find a more interesting question to review.
You're still free to downvote them.
 
@Mast I do both those things, now. It's just sad seeing so many people, IMO, waste their time on answering these questions.
 
@Peilonrayz There's too many low-quality questions for varying reasons, yes.
 
@Peilonrayz I might ever be useful for somebody else... you could invite the user to chat and ask for their reasoning if it really bothers you ;)
 
10:19 AM
@BobRodes Thankyou for that, I agree both SO and Code Review no longer help beginners which is ironic because everyone here was once a beginner at some point — Thinkingabout 10 secs ago
 
@Ludisposed I may be a bit pessimistic, but if hundreds of answers repeating the same thing doesn't help, what's a flame-war in chat going to do?
 
0
Q: How to divide a large method into 2 smaller methods

Atilla AdrianopolosI have created a method that is responsible for the creation and the saving of memes. This is a huge mistake because now I need to use 1 of those functionalities (creating) for a different purpose. I tried to divide them into different methods but the code is tightly chained together. For example...

0
Q: python script to reverse lookup ip

EmadThe following code i found it on github but i need to modify it but i don`t have knowledge in python unfortunately from urllib import urlopen as o lists = open(raw_input('IP list file name: '), 'r').read().split('\n') for ip in lists: print 'Looking', ip grab = 'null' try: g...

 
@Peilonrayz It's interesting to apply review, so I make new and a new version. Otherwise stop dev once it start working.
 
More somewhat relevant metas here and only partly here.
 
@Peilonrayz I don't think a flame war is going to help anyone, but a justification/reason might be nice.
 
10:29 AM
@LeonidMew The people I'm talking about don't like to apply their review, and so every version is exactly the same. :(
@Mast Yeah, IDK whilst they're tied to my question, I don't read them as answering it.
 
10:45 AM
possible answer invalidation by Neargye on question by Neargye: codereview.stackexchange.com/posts/215267/revisions
 
10:55 AM
@Duga Rolled back
 
0
Q: Finding proper command from list

Oleg DobraI have list of commands and need to select one depending of some enum. I have two approaches: First inject all of the commands and select one depending from enum Create exect commad and return it depending from enum Here is basic example: class MyClass1 { private IEnumerable<ICommand> _com...

 
11:17 AM
1
Q: Get elementary values from a flagged enum

Gert ArnoldI created a little function that returns the elementary values from a flagged enum. By "elementary" I mean the values that are powers of 2, excluding any combined enum values. I was a bit surprised I couldn't find a buit-in method for this in .Net (or I missed it). Let's take this flagged enum: ...

0
Q: JavaFX Exercise Application

VengeancosThis is a pre version of my program. This program is about solving exercises. Because this is one of my first graphical applications, I want to know, what can be improved. To this point I usually created command line programs. You can download the executable here Main.java import javafx.applic...

 
11:39 AM
This site couldn't really answer what may or may not be better for you, and questions asking for opinion based answers are off topic here. If something does the job then that's fine, if you wish to make it shorter, more efficient, or 'cleverer' looking, then perhaps once you have a working script you could post it on Code Review for that kind of advice. — Compo 51 secs ago
 
@Peilonrayz Feel free to post a new meta question if you feel the current ones don't answer it.
That's what it's for.
 
 
1 hour later…
12:54 PM
0
Q: How can I choose the name point I've clicked in?

Rafael FernandesI need to improve this python code. This code is saving mouse clicking coordinates. I would like to set a name in each point I click and set sign where I've clicked. Is that possible? import cv2, numpy as np # Path to source video: output_path = '/home/stephen/Desktop/clicks.csv' # Mouse callb...

 
1:17 PM
Code review, instead of a forEach, use Promise.all(files.map((file) => ...))Juan Mendes 6 secs ago
 
Monking
 
1:33 PM
0
Q: How should I handle the risk of an iterator getting out of its vector?

Mai KarI am coding a game boy disassembler in C++. The program (simplified here) converts a vector of byte into an assembly instruction and print it. To do so, it iterates through the vector of bytes (char) with an iterator. I noticed that with the it!=char_vect.end() condition, there is the risk that...

 
1:54 PM
I think this question belongs on Code Review Stack Exchange. — Roshana Pitigala 39 secs ago
 
2:08 PM
The tool does not need to be cross platform, but should be available/enforced in your code reviewing process, as part of e.g. your Ci or pull request. — t.niese 19 secs ago
 
2:31 PM
0
Q: Redesigning python class hierarchy to eliminate casting

mnowotkaThe big problem of the following code is type casting in ConcreteResource.post method. This indicates an imperfect design. I still would like to have an abstract concept of BaseResource, that makes sure I have a reference to some domain specific api but at the moment of defining the BaseResurce I...

 
I don't have the power to remove the hold on my own. You can petition to have it removed but generally it has to be voted on to reopen it. Having said that, this is more of a code review type question since you have working code. You might try posting this on codereview.stackexchange.com but make sure you read their guidelines and make sure it fits before posting. — JeffC 59 secs ago
Thanks for the update. I'm still not really sure what you're asking. Code review doesn't seem appropriate since it's not compiling. If you are stuck getting it to compile, note that a Minimal, Complete, and Verifiable example should be provided "in the question itself" — trentcl 37 secs ago
 
3:02 PM
This isn't good place for it. This site is for code problem solving, not review. Take a look at codereview.stackexchange.com. — Daniel 16 secs ago
 
3:21 PM
@Mast I did comment asking why, but it's been deleted. I guess I have my answer
 
0
Q: Functional vs non functional approach in python

AdityaThis is not a task, but I want to know what the general consensus is on functional programming. Particularly functional programming in Python. The two snippets of code I am comparing are the following. if files: if isinstance(files, basestring): pattern_good = check_if_exists(files)...

 
3:39 PM
@CaptainObvious Example code
 
From a code review perspective, I think it would be better to make QList<Doc*> *docs into a value list QList<Doc> docs (or a list of pointers (QList<Doc*> if you need polymorphic behavior from the Doc` objects). — metal 22 secs ago
 
0
Q: Longest uncorrupted segment

LudisposedSummary In a block storage system, new data is written in blocks. We are going to represent the flash memory as one sequential array. We have a list of block writes coming in the form of arrays of size 2: writes[i] = [first_block_written, last_block_written]. Each block has a rewrite lim...

 
possible answer invalidation by Mai Kar on question by Mai Kar: codereview.stackexchange.com/posts/215349/revisions
 
3:58 PM
 
4:27 PM
0
Q: Class constructor with async properties set from poke-api

DRogueRoninSo, this is for a clicker game I'm trying to build with Pokémon data drawn from the PokéAPI. Since I'm using Vue.js for the project, Vuex is used to store and share the data between components and I'm persisting and loading the state with LocalForage to IndexedDb. When constructing a Pokemon-obj...

0
Q: Python Code to identify structure of a text file

Uttaran BanerjeeWe have a department in our org that generates a lot of data in flat files. all with different formats. we are now trying to sort this data out and load into a database. as a step 1, i am trying to identify the structure(separator, header, fields, datatypes, etc) of the files using a python scrip...

 
4:43 PM
As an exercise, consider how your code would have to be structured in order to make it support 4-digit, 6-digit, n-digit combintions. The better the design, fewer bugs are potentially introduced by that change. I'd recommend you get your code working as intended, then put it up for review on Code Review - you'll learn a ton of tricks from reviewers! — Mathieu Guindon 46 secs ago
 
0
Q: Recursive parser from Binary to JSON output

RovdjuretBackground I got this interview test and got declined due to not meeting their expectations (e.g they thought this was crap? :D), but never got a reason on what was bad and how they solved it. I want to improve and learn something out of it. Question How can this be better written and what is b...

 
4:59 PM
posted on March 13, 2019 by CommitStrip

 
Monking
 
0
Q: Vba to create a new column and insert array formula

BadjaMy below code is the slowest sub in my workbook. I can't set it to put the Array in immediatley, because the mode is calculated incorrectly (calculates for just one site no) Is there a way to cut this down without breaking the fully functioning code? Sub ModeColumn() Dim wb As Workbook, ws As ...

 
There are several reasons why ppl respond the way they do. It's more that it looks like you haven't read What topics can I ask about and How to ask a good question and [The perfect question]. Your question doesn't comply to any of it. It's not even really a question, more of a code review. And there are other websites for that. Anyway, I also recommend you read my answer here: stackoverflow.com/questions/31230504/…icecub 25 secs ago
 
@CommitStrip lol
The later version is probably even more useful.
 
5:23 PM
If your code works correctly, you should post it on Code Review for feedback. — Code-Apprentice 58 secs ago
I'm voting to close this question as off-topic because it is a code review request. I belongs on Stack Exchange Code Review. — lurker 54 secs ago
 
-3
Q: mips selection sort

veeI have a selection sort in mips that sorts ascending and descending based on the user input of 0 or any other number. I managed to get it to print the array but can't seem to figure out why it won't sort in order. I thought there was initially something wrong with the swap function or check funct...

 
5:44 PM
0
Q: Ncurses Snake game

Sergey KasmyI decided to write a little snake game in c++ to practice and as an opportunity to learn ncurses. It turned out to be much bigger than I anticipated but since I've never really written anything big, I'd be really thankful if you could point out more efficient ways or better practices. Thanks! ma...

 
6:20 PM
yeeeesh ... NNs are annoyingly complicated to learn...
 
0
Q: "Rock, Paper, Scissors" game - follow-up

Maria LauraThis is a follow-up to my previously posted "Rock, Paper, Scissors" game. I did almost everything I was recommended in the answers and I hope you like it. import os from random import choice def player_choice(): while True: print("Rock, paper or scissors?") choice = input(">...

0
Q: Android Java Unit Testing test single functionality should I test all the cases for a single functionality?

Seto ElkahfiI recently post a question about my first approach to unit testing: Android Java Unit Testing model class I have 6 cases that I want to test. Should I test all the cases that I have, or is it enough to select randomly, say 3 cases, for a unit test? For example, this test below I only test 3 cas...

 
6:42 PM
0
Q: Just a calculator made by amateur. Pls give me some advices

HyakkimaruWould you review my code ? It is simple calculator made in 2/3 hours. I am still new and I was trying out some tags. If you can add some comment and say what to do and what to improve I will be really grateful. JS, CSS, HTML var buttonOne = document.forms.formularzCalc.keyOne; var buttonTwo =...

 
7:01 PM
0
Q: c++ linux multithreaded epoll tcp server

prog511I want to use a tcp server to receive and send some data from and to my clients so I started to make this simple server It's targeted for Linux because I currently only buy vps Linux due its low prices I coded it and tested it on Android phone using cxxdroid ide and termux and it works well for m...

 
7:21 PM
0
Q: Debugging aid for collecting objects from everywhere into a single scope

Roland IlligToday I faced a difficult problem where I needed to step through several totally unrelated classes, and I suspected (among others) an object aliasing problem somewhere deep in the framework layers. In Eclipse, I had several breakpoints at which I could look at some of the objects and variables. ...

0
Q: Project Euler, Problem 273

Alex HalProblem I attempted to solve the problem by writing my script in two different ways. my first way is painfully slow. while the second is quite fast, but I am unable to finish writing it. I am using the Brahmagupta–Fibonacci identity for my second solution Can someone point my mistakes? Here is...

 
7:40 PM
0
Q: Better way to process the domain components in my algorithm?

brndngI wrote this algorithm which takes input data from something like a CSV file or a large array that contain a series of String elements in the format of "count, FQDN" and then adds or increments the count of each domain component up to the complete FQDN. For example: // Sample output (in any orde...

0
Q: Parser for simple esoteric language in Rust

FexolmI am writing a compiler for esoteric language as one of my first Rust projects. I am using rust-pest to generate a parser. Since I'm new in Rust, code review would be great. Full source code can be found here. Here is some code snippets. Thanks in advance. ast.rs use std::rc::Rc as Rc; #[de...

 
8:03 PM
Welcome to Stack Overflow. If you separate this into a question and an answer, you can "self answer" it and get credit. Right now as a code review request it is likely to be seen as off topic. There is a separate site in the Stack Exchange network for code reviews, codereview.stackexchange.com but you will want to read their tour before using that site. — Jason Aller 21 secs ago
 
@Duga That looks like a good candidate for a review, though.
Needs only a little bit clean-up.
 
 
2 hours later…
10:14 PM
Code Review is the place to post working code and ask for advice on how to code it better. — Barmar 9 secs ago
 
0
Q: Node.js http retry do while mechanism

user195155Hello i have implemented a simple do/while loop to handle a http request to a third-party. I don’t know when the data i receive will have elements in its array so i retry up to 10 times until the array given to me has data which then i stop and store the data in my database. My question is in te...

 

« first day (2139 days earlier)      last day (1879 days later) »