I am aware of the errors, and NO I cannot use Stack Exchange Code Review since the code has to be working with no bugs. I am posting it here for any advice or tips on direction I should take. It was requested and required that I use a 2D array, so why does it matter where it "came from" or the "design" since I stated all relevant information in the text block above. I am student struggling during these COVID times and it was required my mentor that I use 2D Arrays. I am just asking for advice or tips on what I can do to make this work ! :-) — student266638 secs ago
I have a button component on react native, depending on the "theme" prop I need to render a different style for the button
const OvalButton = ({ title, onPress, theme, style }) => {
switch(theme){
case GRAY_BUTTON:
return (
<TouchableOpacity style={[styles...
Code refactoring techniques are applied to make the code better. Identify and apply refactoring techniques on the following code:
using System;
namespace Calculator
{
class Calculator
{
public static double DoOperation(double num1, double num2, string op)
{
double result = double.NaN; // Default ...
I've written a very poor express server to learn about logins. The first time I did this, there was a mistake, someone could just type in the browser /successfullLoginPage.html and be redirected as if the login were successful.
Now, I'm writing a similar code for practice, but trying to avoid log...
I am fairly new to Python. I wrote a program to take the user inputs which are service, the top-up time, the top-up amount, and exit or stay on the program.
Please review my code. And, can my code be organized? I think it looks a bit messy, maybe it can be shorter?
First, I wrote everything unde...
I am a self-learned programmer and this is my first program.
I would really appreciate any critique on my approach.
Thank you in advance! These are two files denoted by the file: XXXX.py at the top of the code where the program begins. This should automatically download the who data file to the f...
Hint: when you write answers, get them right. Your code uses raw types all over the place. If this were a code review for a job interview, you could walk out after showing up with this. Seriously: your answer might sit here for a long time, and many people are going to read it. Only put up really high quality content! — GhostCat53 secs ago
I am sick of File Explorer's super slow deletion speed, so I tried to write a PowerShell script to make deletion faster, and while it does its job, its speed isn't as high as what I intended it to be.
So my idea is, while the target directory isn't empty, find its first deepest subdirectory, find...
I was Trying out Phaser in java
for(int i=1;i<(input.length-1);i++) {
var result = (input[i] + input[i+1] ) /2;
output[i] = result;
}
it iterates through i=1 to n-2 , get the average of (i,i+1) and writes it in the output array , and I tried to do it in a multithreaded way ...
The following is a trimmed-down example of my actual code, but it suffices to show the algorithmic problem I'm trying to solve.
Given is a DataFrame with events, each with a user ID and a timestamp.
val events = Seq(
("1001", 1),
("1001", 2),
("1001", 3),
("1001", 5),
("1001", 6),
("1002
This is a solution for part 1 & 2 of Advent of Code 2020 Day 9.
Given the example input sample.txt:
35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576
Part 1: find the first number in the list (after the preamble) which is not the sum of two of the n numbers before it. n is th...
Questions here on SO are required to be more specific then this. Having a general discussion about your design is better suited for some other site. I would recommend code review, but that means you would need to write some code first. — super22 secs ago
I wrote a list comprehension to find the indexes of an array where its values equal the values contained into another array:
import numpy as np
import pandas as pd
dates = np.asarray([pd.to_datetime(x) for x in['2020-01-01','2020-01-02','2020-01-03']])
other_dates = np.asarray([pd.to_datetime(...
I am unit testing this method
public String createEncodedImgString(BufferedImage bufferedImage) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
ImageIO.write(bufferedImage, "png", output);
String encodedString = Base64.getEncoder().encodeTo...
I want to save each score in the user profile by sending a JS variable to PHP via AJAX.
This is the code for showing the user’s score. I want to save the content of variable showScore and
sent to the database.
// show score as "score/possible score"
var showScore = "Your Score: " + calcScore +"/"...
As @MarsAtomic already commented, posting this on codereview would sure be more helpful. Stackoverflow is meant for single-aspect questions, but you'd surely benefit more from an overall review of your code. — Ralf Kleberhoff44 secs ago
How could an user input their numbers, for example : "122113333443" and I needed to output "3333".
If they again input something like "1224" I then needed to output "22".
How would this be possible if I don't know which numbers they are going to input and how the code would look like?
I am a tota...
I have a search box with a search field and also a button, but this input field does not work. It doesn't allow me to put any text. I couldn't find a reason why. Here is my code (CSS and HTML).
.search{
width:500px;
height:350;
margin:-350px 0px 0px 800px;
border: 3px solid white;
display: inline...
I'm using python and the genetic-algorithm NEAT to create artificial intelligence that is able to properly play the snake game. What I've got this far is an AI that is able to eat only 3/4 'apples' before dying into some wall. The inputs I'm giving to the AI are: [danger_up (1 if block ahead is ...
Here is the full code : https://colab.research.google.com/drive/1KZZuIa7Lk13ImZLJ3b-kxMfcveOPaWvN?usp=sharing
Here is the article : https://arxiv.org/pdf/2009.07047v1.pdf
I tried to implement the VAE_2 from the above article, but I get only blur images after 200 epochs. The model converge to 1 an...
My aim was to provide functionality for a Flutter app on Windows to accept drag-and-dropped files.
Flutter apps are written in Dart and compiled to native code, but since this is a cross-platform framework there needs to be a native part - the runner app - which kickstarts the Dart part of the ap...
I'm trying to use the 'quad' function for evaluating an integral (that has no analytical solution). However, when I do use it, it gives hundreds of identical outputs, cluttering up the console.
So instead of simply returning "0.0178812568758457, 6.333593604965713e-16" as it should, it returns the...
I've been working on a tic-tac-toe game with Python. It's almost done but I can't replay when I say yes or any of the available options (y, Y, yes or Yes). I do have a play_again() function but still, I can't replay.
My program:
does ask if I want to play again
does take my input (yes or quit)
d...
@CaptainObvious @Mast it keeps going...after taking a peek at the OPs profile I'm reminded of another user that uses many emojis.... "Not that there's anything wrong with that"
I'm doing a program that creates an employee records system that includes user inputted, name, id#, annual salary, and start date. but I can't seem to figure out how to store multiple records that have two separate lists.
add code
```
emptyCheck();//checks to see if text boxes are empty
...
I am currently working through the C# Yellow Book, as a first step in self directed learning. I'm supplementing that with C#8 In a Nutshell, and general searches of the Microsoft C# language references, StackOverflow etc. Working from multiple sources, however, results in sometimes conflicting co...
im beginner to python.
i know none happens when the function when function dont have a return statement.
i have tried reviewing the max2 function i created but i cant notice the problem.
if a > b:
return a
else:
return b ```
Django implements a System Check framework that enables apps to perform checks on settings, runtime, etc. When creating an app, one can plug checks with the framework by following some requirements, one of them being how errors are reported.
The integrations are actually ok, but the error managem...
I think this maybe better suited for CodeReview -- there is nothing wrong with your code and you don't seem to have a problem you are trying to fix. I think keeping them in the same method is fine. Otherwise you're going to have a method that calls another method which is redundant. — Seth Kitchen14 secs ago
This is a follow-up question for A population_variance Function For Various Type Arbitrary Nested Iterable Implementation in C++. Thanks to G. Sliepen's answer, I am trying to implement the mentioned recursive_transform_reduce function here.
The usage description
Similar to std::transform_reduce,...
I was intrigued to see BK in Australia branded as Hungry Jack's and somebody believed it was because AU is a British commonwealth, yet in NZ, also a commonwealth country, the name was not changed
@Meticulous What Charlie Armstrong said is paramount: this isn't a code review service, so when asking a question, having a minimal and reproducible example makes it more likely that the general principle behind your question is obvious, which makes it potentially usable not only for you but for anyone with a similar issue. A good trick is to present your questions as if you were asking a friendly professional with very little time to give: complete, straight to the point, clear question and no pollution from unrelated stuff. The other details are all addressed in the previous links. — laancelot45 secs ago
> When Burger King got to Australia in 1971, it discovered there was already a local restaurant there called Burger King.
> So the local Burger King franchisee — who was Canadian, by the way — chose to go with the name Hungry Jack's instead. And when you walked into a Hungry Jack's restaurant, it was virtually identical to Burger King locations in every way — except name.
I have created 2 radio buttons with labels and used images instead of the radio button. On the selected label the image becomes visible otherwise it should stay hidden. I'm able to make it work but the problem is that the labels are also hidden. I want all the labels to be visible. and only the i...
I am trying to write a powershell script that will allow me to delete some files older than 30 days inside subfolders (e.g. Folder 1 and Folder 2). Additionally, I want to be able to delete folders when a specific folder does not exist. For example, from my example, I want to be able to delete th...
Here is the implementation of C++ brute-force class from newcpp library:
class BruteForcer{
private:
const char start = 1;
const char end = 0;
string s = "";
void PlusPlus() {
int a = 0;
while (true) {
if (a > s.length()) {
s += start;...
I am new to Python, the script below provides the desired output and completes the task as required. I would like to know if there is any better ways of completing what I have written and any ways of speeding up the process?
Thank you for looking.
from netmiko import ConnectHandler
import sys
#...
Problem description: You are given a segment [568023; 569230]. Find integer within given range that has the most natural dividers. If 2 or more integers are found, return the lowest integer among them.
Solution:
def allnums(k):
cnt = 0
for i in range(2, k // 2):
if k % i == 0:
...
I wonder why else code isnt working I tried convert to number but still doesnt working.
function KareAlan() {
var kare1 = document.getElementById("kare1")
.value;
var kare1n = parseInt(kare1, 10)
if (typeof kare1n == "number") {
kare1 = kare1 * kare1 * kare1;
document.getElementById("...
I implemented the solution to the classic Matching Brackets problem:
Given a string containing brackets [], braces {}, parentheses (), or any combination thereof, verify that any pairs are matched and nested correctly.
The code should be correct since it passes several test cases.
I would like to...
I made this project in my free time to try to crack a 4x hashed md5 with a couple of hints but I'm looking for ways I can optimize this algo because it's pretty slow and I know you could probs use threading or some other ways to increase speed.
If you can even point out some minor ways to increas...
I recently learned about classes in python. I only have a brief understanding of them, but I think it's good enough for me to write a tic tac toe program (been working on this for the last week or so). My title may be a little misleading (again, because I only have a brief understanding...) but I...