Before starting, I'd like to say I'm not an advanced user on PHP, I'm still learning.
I'm working on an application where I have a class to handle all database operations and I'm trying to simplify this process and catch errors in a better way. For example, when I want to insert a new user I need...
Thanks @loremipsum. The first of three questions is a "right-way" question indeed, but question 2 and 3 are more "how do you make this work properly?" so hopefully I can get some answers here. I'll check out Code Review. — vmallet13 secs ago
If you have working code that you want peer reviewed for improvements, you should ask on Code Review instead - it was created specifically for that purpose. — Ken White34 secs ago
I am running a PowerShell script that gets show disk usage for drives into html reports. While this works quite well it has a problem on some file servers with a massive amount of files. It can sometimes take up to 1 day in a worst case scenario which obviously isn't ideal. I'm wondering if there...
Each player rolls four dice,
For each odd number rolled the number is subtracted from their total,
For each even number rolled the number is added to their total,
Even numbered dice can be rerolled (once) if the player wants to try to get a higher score.
The highest total wins
The program should...
I have a set of Italian words in a txt file hosted on GitHub.
I use it as stopwords vocabulary for futher NLP tasks.
When I dump from GitHub it returns me, obviously, also \n
Better or more efficient way to replace the special character compared with my working code? :)
import urllib.request
sto...
I need advice on how to make an event and draw mouse lines in the grid. Somehow I can't do it so I can draw straight lines in a grid. But I still have a grid, I don't know how to fix a drawing error. I am adding my Javascript code below. My mouse drawing event doesn't work, it doesn't draw me at ...
I'm making a top-down dungeon minigame where you are a knight and can attack zombies by swinging a sword.
So far I haven't implemented collision, player rect(), enemy rect(), a game over screen, or the player sword animation, but all the code I have so far is working well, even though the main lo...
@DerKommissar Interesting - which character? It was really the characters that made the show so good. SF and near SF TV used to get random dregs for actors that it was refreshing to see something that was well written, well acted, and had quality production.
I'm trying to write a good implementation for a variable size allocator in C as part as an assignment.
The user will allocate a big memory chunk using malloc and will ask us to manage this chunk.
So this is the struct that we all accepted on, and must be used:
/***************************** Struc...
I am preparing for a coding interview, and alongside the Data Structure questions, I want to work on my OOP/OOD capabilities.
I saw this design question on "Cracking the coding interview" book, and I want to implement it in a broader way.
I want to create a superclass "CardGame", which all the ca...
You are being watched
Code Review has an open system
A machine that spies on you on every hour of every day
I know because I built it.
I designed the machine to detect suggestions to post on Code Review but it sees everything
Horrible comments involving ordinary users
Users like yo...
@DerKommissar Are you a very private person? Tall guy in a suit? Highly trained assaissin? Assassin and hacker combined? A dirty cop? A decent and honest cop? Or a maffia boss?
I would guess very private person.
@Donald.McLean Last episode watched: s04e14, watched it yesterday
I am teaching myself c++ by doing a series of exercises.
I liked the idea of working out how hash tables could be done using just the language
and no std calls. I discovered that you cant do
"class member function partial template specialisation" and so worked on options for
how this would be ach...
https://github.com/abdullahinuur/ToDoList
live link at https://abdullahinuur.github.io/ToDoList/
I am new to working with JavaScript and this was the latest project I completed.
I tried to keep everything as separated as possible.
Essentially a project is just the list of todos, and an item is a ...
I have an event handler function which every time is triggered should clear a setTimeout() and set a new timeout.
Now the callback for the timeout has to take few arguments, for example the event object received by the handler.
And that's it. I did it, but I believe that my solution is not optima...
I am working on a grade management system web app for a university and I came up with this database schema
user
|Field |Type |Null|Key|Default|Extra |
|-----------------|------------|----|---|-------|--------------|
|id |int(11) |NO |PRI| |auto_...
I would suggest that you take a crack at it and if you have problems, show us what you tried, show us what is not working, and we can try to help you. Or, if you have successfully done this and are asking for feedback, then maybe codereview.stackexchange.com might be better forum. But, unfortunately, as this stands, it is too broad. Are you asking how to implement an adapter? How to implement factory pattern? How to spy (vs mock)? How to do TDD? Whether unit test is more appropriate than UI test? Etc. — Robjust now
I recently created an array sorting algorithm as a training exercise.
static int[] Sort(int[] arr)
{
if (arr.Length % 2 != 0) throw new NotSupportedException("Arrays with an odd amount of items are not supported.");
if (IsSorted(arr)) return arr;
List<int[]> pairs...
We built a REST API with Django and the Django Rest Framework. As we want to track which endpoints get used how much and which users use what areas, I wrote the following middleware:
class AnalyticsMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def...
A side note: since you actually have a working algorithm that you're looking to improve, it seems a better fit for Code Review. Have you thought about posting there? — El_Vanja48 secs ago
Hello. The code bellow are result of my effort to try understand Object-oriented programming (OOP).
I'm very new into programming field, so, even it's working, that doesn't mean I'm applying the right concepts, and the best programming practices, and that is my main objectives here.
My objective ...
Here's my pythonic approach to leetcode 3Sum, it passes and actually beats 93% in time! However, the code is unweildy and the approach seems much overly complicated. I am looking to clean up the two sum function, and overall approach, but I'm not sure how.
def threeSum(self, nums: List[int]) -
Hey, sorry! I'm super new, I didn't realize there was a more appropriate place to post this. I can repost in CodeReview stack and add some troubleshooting I've tried. - thanks — amac55 secs ago
@amac please don't post this on CR until the code works and you understand it. For more information, Please read the on-topic Help center page — Sᴀᴍ Onᴇᴌᴀ16 secs ago
If you're looking for a peer-review then you should post this question on codereview.stackexchange. It's a community like SO where people tend to give feedback instead of solutions. — Emiel Zuurbier47 secs ago
Yes, sorry. My bad. Code Review isn't the right place for this. However, you haven't described doing any debugging of this yourself; you seem to want us to do that all for you? — Brondahl14 secs ago
I’m voting to close this question because it doesn't belong on Stack Overflow. It belongs on codereview.stackexchange.com. — Scott Marcus29 secs ago
I'm a beginner working through some test interview questions. One is asking me to sort an array without using any helper functions. I am trying to sort the following array from lowest to highest, but am finding the output as 29.50 coming before 18.50, while other numbers are sorted correctly:
var...