While answering this code review question, I proposed a solution with List<DataTable>. I am trying to encapsulate this data structure into a "DataGridView Undo/Redo Manager" class DataGridViewManager and there are several build-in methods including IsUndoable, IsRedoable, Push, Redo, Undo, etc. T...
Here's a example script I wrote for Instagram (Facebook)'s Basic Display API. I did this for myself because I haven't used Instagram's API since their Legacy API was disabled, and I needed to familiarize myself for upcoming projects. It's super easy to understand and is meant for learning purpose...
This site is for fixing broken code, but there is a sister site for improving working code that may be more excited about this question. — Daniel Wagner21 secs ago
I have two function, both have to have unique elements, one with Integers and the other a String who return a list of Char. My runtime is currently quite high and I'm not allowed to use imports, but I was wondering how to improve them:
uniqueInt:: [Int] -> [Int]
uniqueInt[] = []
uniqueInt xs = [x...
I should have mentioned that "How can I optimise my code?" isn't an acceptable question for Stack Overflow (you should probably take the tour and read How to Ask). You might find more luck at Code Review — David Buck51 secs ago
There does not seem to be a practical programming problem to solve here. The question is primarily opinion based. This seems more appropriate for either codereview.stackexchange.com (if you can provide a complete, self-contained example as required for that site) or softwareengineering.stackexchange.com (where broader, open-ended software engineering topics are tolerated better). — Peter Duniho22 secs ago
@PeterDuniho Code Review won't take this. If the question is "wondering whether this algorithm is corectly converted", the first reply you get is "If you don't know, how should we?". Code on Code Review should work and be correct. — Mast51 secs ago
@Mast: ah, good point. The fact does remain, Stack Overflow has the opposite approach, i.e. we help fix code that's broken or otherwise solve problems. If there's no known problem, there's nothing to answer. This site isn't for having other people try to figure out whether code is correct or not either, any more than Code Review is. — Peter Duniho36 secs ago
I will also advice for a bit a complexity on your repro structure and preparation from your side. I will always migrate few submission to the public branch. As I believe that you learn to write from reading. Reading good and bad codes will help improve. And bim you also introduce code review. — Drag and Drop50 secs ago
I build this simple function, trying to use PEP 8 Style, something that I discovered recently thanks to this previous question.
The function works, but I was wondering if:
There is a better way to do it
Description and other stuff are correct
import datetime
def quarter_values_builder():
"""...
"every level has many items" - that's what you could use a loop for. Please share what you've tried so far. Also, if the existing attempt is working and not throwing any error, you might better post this on codereview.stackexchange.com — Nico Haase21 secs ago
@NicoHaase my solution is just three loops, codereview.stackexchange.com -thx, didn't know about it — V-K54 secs ago
I wrote the code to log in php to the admin panel. Everything works as it should. But I am not sure if it is well written code and if it is safe. I care about security. I have read a lot about it but I am still not sure. Please, help me.
<form method="post">
<input type="email" name="email" pl...
I dont get it. If I post question without code, everyone complains: "Show us some code, what have your already tried?" But when I post question with code example I get another reaction: "It is not code review platform!". — vytaute11 secs ago
Problem statement: To make a student and a register class to take and print the data...
the code followed by inputs and outputs:
class Student:
def __init__(self,i,n,s,su,m):
self.id=i
self.name=n
self.standard=s
self.subjects=su
...
You're negating the benefits of pdo because you can't (I believe) bind a table name so you have run the risk of injection. 'what do you think...' questions would be better on a code review forum rather than here. For what it's worth I once went down this path and gave it up as its complicated and full of edge cases - you're better using a specific orm or builder that already exists - or building daos which can manage table names internally - but you risk ending up with lots of duplication or very similar dao methods — imposterSyndrome46 secs ago
My current project is a Settlers of Catan server in Haskell. I often manage to achieve my goals within Haskell, but the code is getting messier as the project grows.
My question is about the placeBuilding :: Board -> Building -> VertexCoordinate -> Board function that places a building on the boa...
To bootstrap our application we have a configuration stored in a JSON file. This config holds different settings, like definition of endpoints (e. g. an API or SMS gateway etc.) or some default values for login.
endpoint.ts
export const isEndpoint = (candidate: any): candidate is Endpoint => {
...
I was going to tag this question with either "clone" or "deep copy" or "deep clone" but it appears we have no such tag.
If as a community we feel this tag is worth creating, then I would go ahead with that.
I love using async-promise-returning functions like this:
// async style
await copyDirectory(`~/myfiles`,`~/copy-of-myfiles`)
// or even old-skool
copyDirectory(`~/myfiles`,`~/copy-of-my-files`)
.then(console.log)
.catch(console.error);
However sometimes when performing async operations I want ...
I've created an IValue Converter in order to Bind to the index value of a Collection.
However it seems to be rather slow/infefficient and I wonder if there is a better/different way to do this.
public class IndexValueConverter : IValueConverter
{
public object Convert(object v...
@ClMend There is no issue with his code nor is it a general question so it is not considered a good question according to SO (as far as I know) it more fits Code Review — Matiiss41 secs ago
I'm new to coding and working on a text based game moving from room to room. The code works in pycharm but according to an instant feedback program I entered it into, it gave some tips on it and I am not exactly sure how how to improve upon it. Here is what it gave me:
The Great Hall string is a...
I have a list of key:
list_date = ["MON", "TUE", "WED", "THU","FRI"]
I have many lists of values that created by codes below:
list_value = list()
for i in list(range(5, 70, 14)):
list_value.append(list(range(i, i+10, 3)))
Rules created that:
first number is 5, a list contains 4 items has v...
I'm building for the first time a new app in Typescript designing it with Proto files.
I'm having doubts about which is the best strategy to manage the many service clients in this web app.
"Best" in terms of a good compromise between user's device RAM and Javascript execution speed (main thread ...
@Donald.McLean Space pirates huh? That would be a great answer to the need for space shanties.
Perhaps it will be guarded by space marines.
Although I don't know if there's a black market specialising in telescopes that size, I imagine the materials in it alone would be worth a bit, not to mention the possibilities for ransom.
I've learned that in C++17, std::invoke isn't constexpr. To make a constexpr version, I could copy the implementation provided here: https://en.cppreference.com/w/cpp/utility/functional/invoke , OR I can complicate things by making my own version that relies on SFINAE, which may potentially be sl...
The goal of each frame of the animation to be the same length as the one before it, regardless of the amount of processing that takes place as the frame is being built.
This is a little animation demo that I wrote to show off the basics of a game loop in Python. With a newbies eyes in mind I have...
I build a small web-app using flask for my parents to text their customers about promotions. I am using Twilio API. I just finished the myapp.com/new-campaign page and I would like to have some suggestions as it's my first full stack applicaton as I just added a new feature: estimated cost of the...
Although a few people have responded, this post might be a better fit for codereview.stackexchange.com, whereas Stack Overflow is better suited for questions that have right/wrong answers — sfuquajust now
@Mast I've added a comment that they should not change the question after someone answers. We may need to have a moderator lock it for as long as they can. They are definitely invalidating the answer.
I have created a thread before Previous code review and I have leanred quite alot and got back to situation where I feel like there should be a possiblity to eventually refactor the code even more. However I have followed the thread answer and improved my code. I hope there could be a way to even...
I guess great minds think alike, @Barmar. I wrote this answer without reference to the CodeReview Q&A, but it does seem like the obvious way to do the job. — John Bollinger44 secs ago
If you want help improving working code, you should post this on CodeReview.SE. If you do decide to do so, please delete the question here. — NathanOliver26 secs ago
With this R script, I have a table called dfmt that lists the location, revenue and franchise. I want to find the franchise pairs that operate together in more than one location.
set.seed(43)
f<-c( 'hilton',
'marriot',
'redroofinn',
'motel 6',
'holiday inn',
...
This may be a good question for Code Review if you expand to show your current solution and some sample data. That site exists to help optimize working code — G. Anderson27 secs ago
i am buildung a website. right now i want to create a unordered list for some examples. but at the beginning of the html code i already did use the "ul" tag. how i am supposed to re use it. i did read something about giving an id but it doesnt work.
enter code here
<!DOCTYPE HTML>
<html>
<head>
...