Disclosure: I am a student right now, so if you see any bad habits in my code, feel free to point them out. I have questions about both the ofstream and ifstream portions of my code.
In the ofstream, the user can create their own shopping list and name it (which will end up being the file name). ...
I've implemented my own insertion sort algorithm, and here's the code.
def insertion(lst):
for i in range(1, len(lst)):
for j in range(i):
if lst[i] < lst[j]:
val = lst[i]
del lst[i]
lst.insert(j, val)
break
...
I would really appreciate constructive feedback and suggestions for this fully-connected neural network I have written with TensorFlow 2, Python 3. It estimates the period and amplitude of a sine curve given 100 sample y-points on the curve.
I am mainly interested in how this can be optimised for...
Is there any way to lower the lines of this code and make it better in terms of being more pythonic. the program collects data from truecar.com and then put them into my database
any help would be highly appreciated
code
import mysql.connector
import requests
import math
# takes the car's na...
I inherited the following regex:
/[^.!?\s][^.!?\n]*(?:[.!?](?!['"]?\s|$)[^.!?]*)*[.!?]?['"]?(?=\s|$)/g
This regex is used to split sentences, and is dealing with things like quotes after periods at the end of a sentence (He said "I don't care.") correctly. I've been playing with this regex, ...
i want make my looping data in one array without index. i had solve it with code above but i think it so crowd and not simple
this my code
$data = array();
while($dt = $this->db->fetchAssoc($res_weight)){
$data[] = array_values($dt);
}
$datas = json_encode($data);
$datas = str_replace("[","",...
Not the place to ask this really. What exactly is Your issue?, also You need to provide Minimal Reproducible Example and put the code here (minimal code). Also for testing Code Review would be better suited — Matiiss40 secs ago
I have the following code with a couple of nested if-else conditions which I would like to refactor. To keep the example simple I do not define the helper functions (like disable_check, check_last_alarm, get_kpi_value, ...)
if disable_check(config, date):
threshold = get_threshold()
last_...
This is my first C++ program. If there is anything i could add or do differently please tell me,it would be nice
I am new to C++ programming and i hope to learn more.
using namespace std;
int main()
{
float a, b, result;
char op;
cout << "Enter an operator." << endl;
cin >> op;...
I was thinking to create a discussion chatroom with the answerer of the question: https://codereview.stackexchange.com/q/259468/230104 In that case, do I need to manually create a new room? or is there an option such that I can import the answer comments to the chatroom?
I was asked to program the following:
Develop a two-player dice game that will have the players roll two 6-sided dice each and get points depending on what they roll. There are 5 rounds in a game. In each round, each player rolls the two dice.
The rules are:
The points rolled on each player’s di...
I have a simple golang app in which I have two background tasks that produce data,
Each of them use it's own channel to signel it produced another unit of data.
I have a single consumer that needs the data form the two other background tasks as input in a 1-to-1 ratio.
What I want to do,for the ...
consider we got a string with a negative zero number as a string, like:
const str1 = "-0.00" or
const str2 = "-0.00000"
what is the best way to remove the - and return the number as a string.
My current approach works like this:
const str1 = '-0.00'
const str2 = '-0.00010'
// is there a anot...
public partial class MazeGenerator
{
[Flags]
public enum Direction
{
North = 1,
East = 2,
South = 4,
West = 8,
Visited = 16,
Start = 32,
Finish = 64
}
public readonl...
I have been working on where I want to notify myself whenever there has been a new change in the payload. For now I have used a mock data to be more clear to what is going on.
There is a specific store which I call for BarryThrillthat I want to check if the displayCountDownTimer (Will show in the...
I had a problem at my work that we have some tasks that need to be executed as fast as possible. To do this we implemented them so they are multi-threaded in an ExecutorService. Originally we had for each different type of task a different ExecutorService (simple Executors.newFixedThreadPool(cpuC...
I have written my first react js web app. It is a portfolio project which is a restaurant website. I have used firebase to authenticate users and to host my website. I am asking the Code Review community to kindly review my code if there are scopes for improving and refactoring the code.
And I fa...
I was wondering if anyone would be able to review my Grade Calculator for a course ERD? I'm looking for ways to improve the current design (if any improvements need to be made that is) and if anyone could review the current MySQL query which is there. In order for this to be reviewed I was told I...
Recent i started my fist "real" project.
My goal is to code the first gen of Pokemon in Java.
I have higly oriented my code on a YouTube viedo
(https://www.youtube.com/watch?v=dEKs-3GhVKQ&list=PLah6faXAgguMnTBs3JnEJY0shAc18XYQZ&index=1).
I have learned a lot working through the tutorial and under...
If you've not got a specific problem you can identify, or an error, this question is better suited for the Code Review Stackexchange site. Btw, in random_student(), the last line should be return Student(*result) - notice the *. That expands your list into multiple parameters which will be received by __init__. That's definitely an error you would have got but haven't shown or identified. — aneroid21 secs ago
Try not to modify lists as you iterate over them, or at least conditionally update the index. This also belongs more on code review SE. — Luke Sawczak13 secs ago
@LukeSawczak Code review is for reviewing working code. — iota44 secs ago
I'm trying to solve the 15 Puzzle problem using IDA* algorithm with a Linear Conflicts heuristic. I already implemented the heuristic from what I understood : link
Here's my goal state ("snail" format) and initial state :
GOAL_STATE =
[[ 1 2 3 4]
[12 13 14 5]
[11 0 15 6]
[10 9 8 7]]
...
inb4 someone reads the wall of text I just wrote to the nominations page :P
I see certain buzzphrases that catch my attention: "It would be nice to have the diamond. Take it as a part of achievement, a badge." "Well, I think to have a more rep would be great."
if these weren't that user's 'cup of tea' then why mention it heh
but i digress
yawns and digs into the code that's running the listservs at FT job
... jeez I should really take the time to rewrite this sucker...
@ThomasWard I did wear my diamond with pride when I had it, and I did put it in my CV. But I think that for the CV it should be the icing on the cake rather than anything else.
import random
import numpy
total_times = 1000000
total_match = 0
person_list = list(range(100))
b = numpy.array(person_list)
for n in range(total_times):
cloth_list = list(range(100))
random.shuffle(cloth_list)
a = numpy.array(cloth_list)
x = numpy.where(a==b)
total_match = ...
My code
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
class Voxel(Button):
def _init_(self, position = (0,0,0)):
super()._init_(
parent = scene,
position = position,
model = 'cube',
...
I have Scheme based lips interpreter written in JavaScript, and inside the parser I have single function for parsing the values. Inside S-Expressions:
function parse_argument(arg) {
var regex = arg.match(re_re);
if (regex) {
return new RegExp(regex[1], regex[2]);
} else if (ar...
I've had a really hard look around the internet and done a fair few different versions of this program, but for some reason it won't work as intended.
Below is a description of the question as well as the input and output expected. Below that is my code.
target = "pizza", "cat", "emu"
u_input =...
I'm writing a VBA program which copies and organizes data from one master sheet into numerous other sheets. One of the recipient sheets unifies all the data from the master sheet which holds the same id number into a single row. For this operation, I am looping through the master sheet for each i...
@SᴀᴍOnᴇᴌᴀ might be because I don't have close vote yet. Close but not yet
so mods can handle it. tosses @Vogel612 the tasks
unrelated: COVID made my workplace rush HARD for work from home. 95 employees, 95 individual work from home systems. tracking and management is a pain. explains why the past year has been chaos for it xD
Sounds like a culture question, as you say. You should probably have some level of code reviews, and code has to meet a coding standard (which everyone agrees on) before it can be merged. — canton756 secs ago
@gunr2171 Yes, it may be, but then this may be the answer. Even though this should be solved on the social level, asking for a technical solution is not wrong. Its a similar question whether you should be enforcing code reviews or make them optional. — PMF29 secs ago
I am have made a small copy-to-clipboard script.
I have made a method called copyToClipboard that does the following:
create an input box;
read the content of an HTML element;
set the input box value to the content previously read;
append the input box to a container;
select and copy its value t...
I have a small and weak microcontroller. I also don't have access to the complex library. I wrote this iterative version of the FFT to hopefully get better performance than the recursive version, and also just to learn how the FFT works, and brush up on C.
I'd like to know if the code itself is u...
Appreciate the answer--the questioning of the rules is legitimate, and we are bending over backwards to listen to the concerns of our teammates and make rules that make sense for our team. We're also looking at every rule before enabling instead of enabling the full suite. We do code reviews, we are reviewing the standards constantly...it's just so hard to get people to care when they just plain don't, and I'm not sure how to get people to care. I guess we'll just have to be super thorough looking for those #pragma disables if we can't catch that automatically. — erikjwjust now
I am currently working on a school project and I want feedback on the code below to further enhance my coding knowledge and skills.
Any feed back would be greatly appreciated. The program is written in JavaScript.
/*
*/
var images = [
"september october november",
[
'../images/fallPics/f1....
Hi Mast! Not sure if im allowed to ask question here but I saw your commenting my code review question and thought maybe it would be easier to ask you here as well while we are here. but Up to you :D I commented back
This is a sparse matrix (dgCMatrix) class that extends Rcpp.
WHAT: This class includes Rcpp::NumericVector and Rcpp::NumericMatrix classes which are simple references to R objects. This class fully supports reference-only no-copy conversion of the Matrix package dgCMatrix class from R to C++ and ...
You really want to start using template strings, all this string concatenation is one giant bug-waiting-to-happen. Also, innerHTML that adds <br>? There is a lot here that you want to post to codereview about to get some help writing better (and modern) JS. — Mike 'Pomax' Kamermans53 secs ago
I have 3 nested loops and they do the following:
Get scopes from DHCP
Get hostnames from csv file
Compares hostnames and leases, matches are added to a hash table
There are 5 DHCP servers, 100's of scopes and thousands of leases.
What would be a good method to speed this up?
Thank you!
$DHServe...
Two ways you can type @ProtractorNewbie or hover over a message you want to reply to, you should see a down arrow on the very left, click and "reply to this message"
I have been working on where I want to notify myself whenever there has been a new change in the payload. For now I have used a mock data to be more clear to what is going on.
There is a specific store which I call for BarryThrillthat I want to check if the displayCountDownTimer (Will show in the...
I am learning Kotlin for Android dev. I do not have anyone to review my code and give feedback.
Please review the following project and let me know how I can make it better in terms of scalability if I add 3-4 different modules like login, detail pages
Kotlin-MVVM-Room-DataBinding
I am using Obse...
Hmm... It looks like the bug is originates somewhere in the section where you preprocess the matrix as opposed to where you solve for the shortest path. That said, I would need to understand your project in much greater detail to be able to give any meaningful advice - which I unfortunately can't do at the moment. You can however try this site codereview.stackexchange.com which might be able to help in that area. — LPR36 secs ago